Answers for "last element of a list become the first haskell"

3

last element of list haskell

list = [1, 2, 3, 4]

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

last list -- 4
Posted by: Guest on October-18-2020

Code answers related to "last element of a list become the first haskell"

Browse Popular Code Answers by Language