Skip to content
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

Range operator assumes increasing direction #98

Closed
skx opened this issue Nov 22, 2023 · 0 comments · Fixed by #100
Closed

Range operator assumes increasing direction #98

skx opened this issue Nov 22, 2023 · 0 comments · Fixed by #100

Comments

@skx
Copy link
Owner

skx commented Nov 22, 2023

This works:

 puts( 1..5 )

This does not return what you expect:

 puts(10..0)

Instead of "10, 9,.." you get "10, 11, 12 ."

We should be able to count down as appropriate.

@skx skx mentioned this issue Nov 22, 2023
skx added a commit that referenced this issue Nov 22, 2023
This pull-request closes #98, by ensuring that the range operator
(`..`) can count down as well as up.  This allows ranges such as:

* 3..10
* 4..0

However note that the first number cannot be negative, as that's
then treated as "- [1, 2..]" - i.e. negative array, which makes
no sense.  This should be resolved, but it is a bigger job.
@skx skx closed this as completed in #100 Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant