User loginNavigation |
archivesusing foldr to do mapI am reading Hutton's book, programming in Haskell, and got stumped by a question. redefine map f using foldr. Since foldr is described as replacing (:) in a list with some provided operator it seemed it shouldn't be too hard. So I tried this: > folmap :: (a -> b) -> [a] -> [b] My reasoning is that you apply the : operator after f on every value in the list. (Though I may not understand the (.) I was thinking that if f = (a ->b) and g = (b -> c) then g.f would be g performed after f (or g.f is f followed by g). Any advice?? |
Browse archivesActive forum topics |
Recent comments
22 weeks 2 days ago
22 weeks 2 days ago
22 weeks 2 days ago
44 weeks 3 days ago
48 weeks 5 days ago
50 weeks 2 days ago
50 weeks 2 days ago
1 year 6 days ago
1 year 5 weeks ago
1 year 5 weeks ago