4 ms·
I think the way to do this functionally is the Haskell way with Monads: http://en.wikipedia.org/wiki/Monads_in_functional_programming http://en.wikipedia.org/wi
by adamdoupe 19y ago
I think the way to do this functionally is the Haskell way with Monads: http://en.wikipedia.org/wiki/Monads_in_functional_programming http://en.wikipedia.org/wiki/Monads_in_functional_programming
Having used Haskell (which is purely functional) to write a compiler for a CS class, state is mostly kept by passing it around and using recursion. It's hard to explain if you don't know Haskell, however the other way is to use Monads. I can't explain them, because I don't understand them completly myself. Anyhoo, good luck.