Hacker News new | past | comments | ask | show | jobs | submit login

One my favorite features that came out of reducers - short circuiting reduce!

   (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.



YES, I was hunting around for this in 1.4, happy to see it's arrived.


This is so beautiful, like recur's blessing in disguise.


cool




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: