Oke,

I'm not sure I understand you right.
 
Let's say I have this list [1,2,3,4]
How must I use head now ?
 
Roelof
 
Date: Mon, 27 Jun 2011 14:50:14 +0300
From: mats.rauhala@gmail.com
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] first number is a list

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


--
Mats Rauhala
MasseR

_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners