Last element of list haskell

Code examples

3
0

last element of list haskell

list = [1, 2, 3, 4]

last [a] -> a
last [x] 	= x
last (_:xs) = last xs

last list -- 4
2
0

haskell get last element of list

list = [1,2,3,4,5]
last list -- returns 5
2
0

last element of list haskell

list = [1, 2, 3, 4]

last [a] -> a
last [x] 	= x
last (_:xs) = last xs

last list -- 4

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................

Popular in the category

Popular pages with examples in the category