d2b2 evaluates to something of type [Int] , right? Which means the expression (d2b2(n / 2):1) is trying to pass an [Int] as the left-hand argument of the (:) function. Since the (:) function is of type a -> [a] -> [a] , that means it expects on the right-hand side a list of whatever was on the left hand side. That means it expects a list of [Int] , i.e. something whose type is [[Int]] . Instead of an expression of type [[Int]] , you're supplying 1, or 0, something of type Int . That's the reason your error message is the way it is.
The function (:) is for appending elements to the left end of a list. If you want to append an element to the right end, wrap the element in a list an use a (++) operator. For example: [1,2,3] ++ [x] => [1,2,3,x] .
You have a number of other problems with your code. One of them has to do with this question: What do you expect 'return' to do?
Last edited by Rashakil Fol; Feb 2nd, 2009 at 8:19 pm.
Reputation Points: 1133
Solved Threads: 171
Super Senior Demiposter
Offline 2,478 posts
since Jun 2005