Completed
Details
Assignee
UnassignedUnassignedReporter
Ambrose Bonnaire-SergeantAmbrose Bonnaire-SergeantLabels
Approval
OkPatch
Code and TestPriority
MajorAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Ambrose Bonnaire-Sergeant
Ambrose Bonnaire-SergeantLabels
Approval
Ok
Patch
Code and Test
Priority

Affects versions
Fix versions
Created April 2, 2015 at 2:14 AM
Updated April 10, 2015 at 4:58 PM
Resolved April 10, 2015 at 4:58 PM
1.7's iterate calls its function one extra time than in 1.6
;; clojure 1.6 user=> (take 2 (iterate zero? 0)) (0 true) ;; clojure 1.7-alpha6 user=> (take 2 (iterate zero? 0)) ClassCastException java.lang.Boolean cannot be cast to java.lang.Number clojure.lang.Numbers.isZero (Numbers.java:92)
This is because Iterate.java calls its function in its "next" method rather than in its "first" method.
Approach: Iterate now holds a prevSeed that will allow computation of a lazily computed seed (the first of the iterate sequence). The very first node will be initialized with the initial seed. All other uses of seed need to ensure first is called to force realization before using seed.
Patch: clj-1692-3.patch
note there were two copies of test-iterate so one is removed in the test, allowing the more expansive one to be called.