Details
-
Type:
Enhancement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Patch:Code
Description
This returns 16:
(reduce (fn [acc x]
(let [x' (* x x)]
(if (> x' 10)
(reduced x')
x')))
(range))
But replacing `reduce with `reductions will never terminate:
(reductions (fn [acc x]
(let [x' (* x x)]
(if (> x' 10)
(reduced x')
x')))
(range))
This is because `reductions ignores 'clojure.lang.Reduced, it never tests for `reduced?
I know that I only just discovered the `reduced, function, but `reductions is a big part of my debugging process, so it's unfortunate that they don't work together.
Attaching patch