-
-
Notifications
You must be signed in to change notification settings - Fork 382
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 list transformation expression and effect #7028
Conversation
I think this needs a much better description and examples because I honestly can't work out what it's actually for even when I'm reading the code for it. |
I would welcome suggestions! I'm not really sure how i should go about improving the descriptions because I don't really know where the fault is. It makes sense to me, which is obvious otherwise i wouldn't have written it this way, but I'm not sure where it's failing for others. To explain it in java terms, this expression/effect is equivalent to |
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.
This is very sick, and very useful. Just some tiny, non-code related things.
Co-authored-by: cheeezburga <47320303+cheeezburga@users.noreply.github.com>
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.
Description for transform syntax could still use some improvement. I suggested adding something like
Applies the given function to each element in the list, replacing the original element with the function's result.
but you might be able to come up with a better alternative (maybe function is a bad word since it's not actually a script function).
Co-authored-by: Moderocky <admin@moderocky.com>
Co-authored-by: Efy <35348263+Efnilite@users.noreply.github.com>
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.
This is great work. A few thoughts 🙂
Description
Adds transformation/mapping syntaxes for lists:
The effect only works on variable lists, but allows the indices of the list to be retained (if the expression is singular).
The expression works on any list, but naturally cannot retain indices.
If the expression is plural, this acts like flatMap, where
x,y,z transformed with (a, b)
will returna(x), b(x), a(y), b(y), a(z), b(z)
.Also allows ExprFilter to use () as grouping markers as well as [].
I'm still not convinced on the syntax wording and would like opinions and alternatives!
(i know i touched ClassInfo but i'm not cleaning all of that up!)
Target Minecraft Versions: any
Requirements: none
Related Issues: closes #3573