[Haskell-beginners] first number is a list
mats.rauhala at gmail.com
Mon Jun 27 13:50:14 CEST 2011
I'm sorry, I'm not entirely sure what you're trying to do. Are you
trying to find the first number _in_ a list? That could be done with for
example pattern matching:
head (x:_) = x
head _ = error "Empty list"
The guards in list comprehension requires booleans, you gave it a
function that takes a list and returns an item of the same time.
last :: [a] -> a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: not available
More information about the Beginners