G'day all.

Quoting Asfand Yar Qazi <[EMAIL PROTECTED]>:

> 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
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to