
29 Dec
2006
29 Dec
'06
2:47 p.m.
Sorry to Neil for multiple copies.
On 29/12/06, Neil Mitchell
I am not sure how to express f1 with map? how do I say (lambda (ls) (map (lambda (x) (list x)) ls)) in Haskell? map ([]) ?
map (:[]), :[] takes a single element and puts it into a list. Some people refer to this as "box"
You can pretty much directly translate your Lisp: \ls -> map (\x -> [x]) ls Which eta-reduces to: map (\x -> [x]) Now the inner lambda can be written as: \x -> x : [] Or, (: []) That's a section on the ':' operator. So the whole thing becomes: map (:[]) Hope that helps. -- -David House, dmhouse@gmail.com