Re:Using Monads in C++ to Solve Constraints: 1. The List Monad
by tezka on Monday May 11, 2015 @08:19PM
(#9528741)
Spoken like a true Haskell fanboy. Why don't you give it a shot, OP has posted the code.
Re:Using Monads in C++ to Solve Constraints: 1. The List Monad
by alricb on Monday May 11, 2015 @08:54PM
(#9528881)
Shriram Krishnamurti to the rescue! Here's a memoized version in scheme: http://blog.racket-lang.org/2012/08/dynamic-programming-vers...
Certain highly stateful algorithms may be difficult to translate into Haskell, in the same way that certain highly structural or lazy algorithms may be difficult to translate to C++.
I'm curious if your time complexity analyses are accurate, given that you (admittedly) did not understand the faster algorithm. You could be getting tripped up by laziness.
In general, I've found that most production Haskell code is quite fast, in both big-O and absolute terms.