by JeanPierre · 13y ago · 0 comments
Another slightly interesting thing is the sudden enhancement to read-eval and EDN[2]. That's mainly because of the rough weather Ruby/Rubygems was in with the YAML-exploits, which caused a heated discussion on how the Clojure reader should act by default[3][4].
[1]: http://www.infoq.com/presentations/Clojure-Reducers
[2]: https://github.com/clojure/clojure/blob/master/changes.md#21...
[3]: http://dev.clojure.org/jira/browse/CLJ-1153
[4]: https://groups.google.com/d/topic/clojure-dev/zG90eRnbbJQ/di...
(reduce
(fn [a b]
(if (> a 100) (reduced a) (+ a b)))
(range 100000))
=> 105
I've often had to use loop/recur instead of reduce because you could not short circuit. No longer.