3 ms·
I'm with you about the general idea and I'm not a pure functional programmer (just getting into Clojure). I've often thought of this before and I do appreciate
by virmundi 12y ago
I'm with you about the general idea and I'm not a pure functional programmer (just getting into Clojure). I've often thought of this before and I do appreciate the answers to your inquiry.
Based on the answers here and prior thought, I believe that Monads are Noble Lies [1]. Impurity is a hard concept. Purity is the goal. So rather than accepting into a well designed model the idea of impurity one should say something is pure even if it actually thunks at the end. This keeps the overall model sound. For people that really don't want or need or can't get into the details of real life mutability, you can keep the model as is with the lie of glossing over the thunk.
1 -http://rationalwiki.org/wiki/Noble_lie http://rationalwiki.org/wiki/Noble_lie
- serve_yay 12y agoIt does seem that way. I can't really understand the value of that, typically we want our models to model reality and not lie to us.
- noelwelsh 12y agoImagine you have to organise a large group of people to do some complicated job. You give everyone very explicit instructions (computers are better at following instructions than people, but imagine that these people are good at this). Nobody does anything until you've finished giving instructions. Then you shout "go!" and everything happens. This is what we're doing here. We very explicitly separate our program into two times -- giving the instructions, and shouting "go!" (calling run). Before we shout "go!", substitution holds. Once we shout "go!" we don't give instructions any more. In Haskell you don't even call `run` -- the runtime does this for you. There is no Noble Lie. There is a time (a world if you like) where substitution holds. We assemble our program in this time / world. There is a time / world where the program is run. We don't construct the program in this world. (This may sound restrictive, but it isn't.) Play with the code. The example is straightforward and easy to extend.