MGlacier
0
Q:

get tail of list haskell

list = [1, 2, 3, 4]

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

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

tail :: [a] -> [a]
tail [] = []
tail (_:xs) = xs
0

New to Communities?

Join the community