
26 Dec
2015
26 Dec
'15
9:19 a.m.
As a newbie, I'm studying the pdf 'the Haskell road to logic, math and programming' and I'm stuck with one exercise. I want to extract x if x is at the beginning of a list. I thought to use something like this: extractIfBegins x [xs] | [xs] == (x:ys) = [ys] | otherwise = [xs] But ghci complains that ys is not defined. Without giving the answer, can someone give a hint about the approach to follow ? -- Fabien