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

PR: builtin range function #326 #328

Merged
merged 12 commits into from
Mar 2, 2021
Merged

PR: builtin range function #326 #328

merged 12 commits into from
Mar 2, 2021

Conversation

endink
Copy link
Contributor

@endink endink commented Mar 2, 2021

add builtin range function:

range(start, stop[, step])

usage examples:

range(0,0) ----> []
range(0, 5) -----> [0, 1, 2, 3, 4]
range(0, 10, 3) -----> [0, 3, 6, 9]
range(0, -10, 2) -----> [0, -2, -4, -6, -8]

special:

The step must be greater than 0 to prevent infinite loops

@geseq
Copy link
Collaborator

geseq commented Mar 2, 2021

Nice one!

I would expect range(0,0) to be [] for consistency.

@endink
Copy link
Contributor Author

endink commented Mar 2, 2021

@geseq Okay, i will change range(0,0) to be [] , any ideas for support for a single parameter?

range(5) to [0, 1, 2, 3, 4], current implementions are not supported, if you want, i can support it

@geseq
Copy link
Collaborator

geseq commented Mar 2, 2021

I think you might be right and I can see one argument being confusing. I pretty much pulled the idea out of python but we don’t need to stick exactly to python syntax.

@endink
Copy link
Contributor Author

endink commented Mar 2, 2021

@geseq ok, Use the same upper and lower bounds will get empty array ( [] ) as you expect, github action seems to have some problems ? please check this PR. I think it's done now !

errors.go Outdated
@@ -49,6 +49,10 @@ var (
// ErrNotImplemented is an error where an Object has not implemented a
// required method.
ErrNotImplemented = errors.New("not implemented")

// ErrNotImplemented is an error where an Object has not implemented a
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d5 ok, it fixed

@geseq
Copy link
Collaborator

geseq commented Mar 2, 2021

I've merged a fix for the GitHub Actions to master. Please rebase with master

@d5
Copy link
Owner

d5 commented Mar 2, 2021

please fix linting issues too!

@endink
Copy link
Contributor Author

endink commented Mar 2, 2021

emmmm.... okay, I will fix go lint problem

@d5 d5 merged commit 8858304 into d5:master Mar 2, 2021
@endink endink deleted the pr_range_fuc branch March 2, 2021 07:08
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 this pull request may close these issues.

3 participants