Open practicalli-johnny opened 4 years ago
It looks like there are better ways:
(reduce * (range 1 (inc 5)))
;; separation of collection-creation from -reduction unlocks quite a few "new" abilities. E.g. inspection: (reductions * (range 1 (inc 5)))
* Parallel version of the functional implementation: https://youtu.be/GvJm-eJ5o18?t=1617 (what a performance gain!)
* And absolutely mind-boggling is the https://youtu.be/GvJm-eJ5o18?t=2242
I always felt like logic programming is the real way how we should use and program our computers! It's just that I can't really get my mind set up for it, so I always end up programming things the usual way. (At least I transitioned from object-oriented & imperative to functional style. Maybe one day, hopefully...)
https://www.freecodecamp.org/forum/t/clojure-loop-recur/18418