-
-
Notifications
You must be signed in to change notification settings - Fork 417
Add reduce/fold Expression #8353
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
base: dev/feature
Are you sure you want to change the base?
Conversation
…ist elements into a single result, and add reduced value to access the value within reduce expressions
sovdeeth
left a comment
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.
looking great
just some minor stuff
Co-authored-by: sovdee <[email protected]>
sovdeeth
left a comment
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.
some minor tweaks, otherwise looks great!
Co-authored-by: sovdee <[email protected]>
sovdeeth
left a comment
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.
looks great
i'll handle the registration api stuff in a later pr that updates all the stream-like syntax (filter/map/sort)
APickledWalrus
left a comment
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.
Great work so far, I love this idea!
…to feature/reduce
Co-authored-by: Efnilite <[email protected]> Co-authored-by: Patrick Miller <[email protected]>
…to feature/reduce
Absolutionism
left a comment
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.
Should be moved to the org.skriptlang.skript.bukkit.misc package.
Should also be using SyntaxRegistry as Skript.registerExpression is deprecated
See
(It also isn't a bukkit syntax) |
|
I apologize, I suffer from “I didn’t see that and I’m dumb” syndrome |
APickledWalrus
left a comment
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.
Just about ready. Great work so far!
Co-authored-by: Patrick Miller <[email protected]>
Problem
This adds the first class function 'reduce/fold' as an expression applies an operation to accumulate list elements into a single result, and add reduced value to access the value within reduce expressions
Solution
ExprReducewas made similarly toExprFilterandExprTransform, except I did not use any of the smart flatMap and Stream usage because I wouldn't know how to do that.ExprReducedValuewas made similarly toExprInputwithout type support I guess. I mainly went off of intuitionTesting Completed
src/test/skript/tests/syntaxes/expressions/ExprReduce.sk
Supporting Information
none
Completes: none
Related: none
AI assistance: Google search AI overview once or twice (?) I also previously used AI when I was younger to learn Java.