Hi,

If I define the follwoing functions:

car (x:_) = x
car [] = []

cdr (_:xs) = xs
cdr [] = []

and try to apply them to some list, such as

car [1,2,3]

I get this odd error:

<interactive>:1:9:
   No instance for (Num [a])
     arising from the literal `3' at <interactive>:1:9
   Possible fix: add an instance declaration for (Num [a])
   In the expression: 3
   In the first argument of `car', namely `[1, 2, 3]'
   In the expression: car [1, 2, 3]


What am I doing wrong this time? :-P

Thanks



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to