
Hello John, Tuesday, January 30, 2007, 2:57:04 PM, you wrote:
mergeForest2 = map pairToNode . Map.toList . Map.map mergeForest2 . Map.fromListWith (++) . map nodeToPair
My problem I guess is being able to write the code this way when the need arises or even just recognising when and where it's an option, both of which to me is considerably harder.
i guess that it's just imperative style of thought that you can't easily scrap out. the whole idea of functional programming is that you make data *transformations*. you start with one data representation, then transform it into another, then you can make some sub-transformations with sub-elements of your data (using various "map"s), then you may glue data together using various folds and so on. there are real difference between imperative style do-it-after-that and functional style "map original data into result" btw, are you seen http://haskell.org/haskellwiki/Simple_unix_tools ? :) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com