-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Strange behavior with Seq range, reverse #1730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It might be a side-effect of Range function defaulting to Infinity. You can see #1801 for more informations. You can force the behaviour as a matter of fact: Seq([1, 2, 3]).zip(Range(0, 3))
.reverse()
// results as expected: : [[3, 2], [2, 1], [1, 0]] |
OK I think I do understand the issue: actions are deferred to the latest moment possible, to
But as the "end" value is #1967 does change the In a probably more complex example, you will need to do that: const mySequence: Array<number> = getSequence();
Seq(mySequence).zip(Range(0, mySequence.length - 1)).reverse(); You can change the const mySequence: Array<number> = getSequence();
Seq(mySequence)reverse().zip(Range(mySequence.length - 1, 0)); |
Closing as you should explicitly set start and end values in your range in 4.x version |
What happened
and run this code below with https://clojurescript.io/
I think those codes are equivalent and Clojure's output is correct output.
Is this desired behavior?
Immutablejs Version: 4.0.0-rc.12
The text was updated successfully, but these errors were encountered: