> How's this? What about ++, in Haskell thats just an ordinary function, yet you are using the library one in this case.
The other thing is that the first definition of my_concat_map is entirely redundant, the second one handles both cases anyway. Also, for completeness, you might be interested to find that in some compilers the list is actually defined as: data [] a = [] | (:) a ([] a) This isn't legal Haskell 98, but nhc and Yhc both define a list similarly to this. Thanks Neil > > myhead :: [a] -> a > myhead (x:xs) = x > > mytail :: [a] -> [a] > mytail (x:xs) = xs > > mymap :: (a -> b) -> [a] -> [b] > mymap fn [] = [] > mymap fn (x:xs) = fn x : mymap fn xs > > myconcat :: [[a]] -> [a] > myconcat (x:xs) = x ++ myconcat xs > myconcat [] = [] > > -- For each a in [a], produce a [b] in another list, then concat the > -- list. > my_concat_map :: (a -> [b]) -> [a] -> [b] > my_concat_map fn [] = [] > my_concat_map fn xs = myconcat (mymap fn xs) > > stateslist :: StateNode a -> [a] > stateslist(State x) = [x] > stateslist (CompositeState xs) = my_concat_map stateslist xs > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
