-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add the reverseRangeFunc
& rangeFunc
methods on ArrayUtils
contract to support decreasing ranges
#17
Add the reverseRangeFunc
& rangeFunc
methods on ArrayUtils
contract to support decreasing ranges
#17
Conversation
cc @bjartek @bjartek @austinkline @turbolent |
rangeFunc
method on ArrayUtils
contract to support reversed range (declining)rangeFunc
method on ArrayUtils
contract to support reversed range (decreasing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bluesign thoughts on this? We might be better off defining a reverseRangeFunc
so that users know this is an option. I would expect that end being less than start would panic but totally get the value of combining these.
…act to support decreasing ranges
ceb1c24
to
10a80d7
Compare
rangeFunc
method on ArrayUtils
contract to support reversed range (decreasing)reverseRangeFunc
& rangeFunc
methods on ArrayUtils
contract to support decreasing ranges
I have added separate methods for |
@austinkline Kind reminder 🙏 |
Thank you! |
The reverse function accepts an array as an argument, and returns its reversed version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
BTW, seeing the range helper functions in the array utils contract triggered this feature idea for the Cadence standard library: onflow/cadence#2482. Please chime in if you would like to see range functionality in Cadence itself! |
That's nice! I'll add some feedback there too 🙏 |
Examples:
Update: Cadence tests for the
ArrayUtils
smart contract, were added: