
27 Jun
2011
27 Jun
'11
7:48 a.m.
2011/6/27 Roelof Wobben
Hello,
I have to find the first number is a list.
So first I tried :
let mylast = last [1,2,3,4] mylast
I'm confused : You say have to find the first number of a list but this gives you the last.
[x | x <- [1,2,3,4] , last ]
But then I see these error : Could not match expected type "Bool" with actual type [a0] -> a0
It's quite clear: The compiler expects a function that'll return a Bool value, but you gave it one that takes a list and returns an element from the list. Additional terms in the list comprehention are meant to be filters on elements of the list, not functions that work on the list. David.