Re:Functional thinking: Why functional programming is on the...
by eru on Tuesday January 29, 2013 @08:47PM
(#5137611)
For something as simple as fibonacci, you wouldn't use the state monad machinery, but go directly:
The state monad helps you keep more complicated code composable. But it does have some syntactic overhead, that makes it lose out in simple examples. (Though with a bit of golfing, you could get syntactically closer to the Python example. For example putting the tuple (x,y) into an STRef instead of having two of them, employing Applicative Functor style in some places, and using a loop-combinator from the monad-loops package.)
[ Parent
| on HN ]
There are no comments on this comment yet.