takin last n elements from list haskell code example
Example: last element of list haskell
list = [1, 2, 3, 4]
last [a] -> a
last [x] = x
last (_:xs) = last xs
last list -- 4
list = [1, 2, 3, 4]
last [a] -> a
last [x] = x
last (_:xs) = last xs
last list -- 4