3 ms·
> It is somewhat surprising that unification is cleaner and easier to implement in an loopy imperative mutational style than in a recursive functional pure styl
by jhp123 2y ago
> It is somewhat surprising that unification is cleaner and easier to implement in an loopy imperative mutational style than in a recursive functional pure style.
I came to a similar conclusion, my implementation uses recursion but also leans on shared mutable variables, which is something I usually avoid especially for more "mathy" code. https://jasonhpriestley.com/short-simple-unification https://jasonhpriestley.com/short-simple-unification
- nyrikki 2y agoI think your choice is more readable and maintainable, but did you consider call-with-current-continuation? It is easy to dismiss, but this may be a situation to learn where it is actually useful.
- convolvatron 2y agothe author used the phrase "some wacky continuation thing" to describe that alternative. I agree, but I also have used recursion here, and struggle to find why given the text the author finds it so problematic. the simple mapping binds the evaluation order at compile time - maybe that's the real problem they are identifying.