14 Mar
2006
14 Mar
'06
1:49 a.m.
G'day all. Quoting Asfand Yar Qazi <ayqazi@gmail.com>:
Actually, I'm trying to avoid library functions, so I can learn the language and the functional way of thinking. How would one implement the concatMap function?
See if you can work how how this one works. No library functions, apart from function composition. statesList :: StateNode a -> [a] statesList s = statesList' s [] where statesList' (State x) = (x:) statesList' (CompositeState xs) = statesLists xs statesLists [] = id statesLists (x:xs) = statesList' x . statesLists xs Cheers, Andrew Bromage