Public feed #1402463

Mine

public text v1 · immutable
Raw Edit
·published 2009-04-25 01:48 UTC
rendered paste body
-- Write a function, lastButOne, that returns the element before the last.
lastButOne :: [a] -> [a]
lastButOne xs = if null xs 
                then xs
                else head (drop ((length xs) - 2) xs)