3 ms·
I just started reading Norvig's PAIP, and one of the things that surprised me was seeing lisp code written in a non-functional manner. Of course the code in PAI
by radu_floricica 17y ago
I just started reading Norvig's PAIP, and one of the things that surprised me was seeing lisp code written in a non-functional manner. Of course the code in PAIP evolves and the early iterations are "bad" on purpose, but it's amazing how obviously wrong some early patterns seemed just because I was used to Clojure's more functional style.
- lispm 17y agono, they are not 'bad on purpose'. Peter Norvig shows how to get from quick bottom up prototypes to optimized code. The purpose is to quickly and cleanly as possible get a first version going and then improve that. Common Lisp programs make heavy use of side effects from imperative code, over destructive operations to the CLOS object system.
- radu_floricica 17y agoI haven't programmed at all in lisp and less then a year in Clojure so my opinion doesn't carry much weight, but I did notice that a) imperative code is harder to read and b) later versions look more functional. So for what's worth I'm happy Clojure considers functional style and immutable data as defaults.