Skip to content

Conversation

@miberss
Copy link

@miberss miberss commented Jan 5, 2026

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

ExprReduce was made similarly to ExprFilter and ExprTransform, except I did not use any of the smart flatMap and Stream usage because I wouldn't know how to do that.

ExprReducedValue was made similarly to ExprInput without type support I guess. I mainly went off of intuition

Testing 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.

…ist elements into a single result, and add reduced value to access the value within reduce expressions
@miberss miberss requested a review from a team as a code owner January 5, 2026 23:12
@miberss miberss requested review from cheeezburga and erenkarakal and removed request for a team January 5, 2026 23:12
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jan 5, 2026
Copy link
Member

@sovdeeth sovdeeth left a 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

@sovdeeth sovdeeth changed the base branch from master to dev/feature January 6, 2026 01:10
@sovdeeth sovdeeth added the feature Pull request adding a new feature. label Jan 6, 2026
@sovdeeth sovdeeth moved this to In Review in 2.15 Releases Jan 6, 2026
@miberss miberss requested a review from sovdeeth January 6, 2026 01:12
Copy link
Member

@sovdeeth sovdeeth left a 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!

Copy link
Member

@sovdeeth sovdeeth left a 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)

Copy link
Member

@APickledWalrus APickledWalrus left a 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!

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jan 6, 2026
@miberss miberss requested a review from APickledWalrus January 7, 2026 07:16
Copy link
Contributor

@Absolutionism Absolutionism left a 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

@sovdeeth
Copy link
Member

sovdeeth commented Jan 7, 2026

Should be moved to the org.skriptlang.skript.bukkit.misc package.
Should also be using SyntaxRegistry as Skript.registerExpression is deprecated

See

looks great
i'll handle the registration api stuff in a later pr that updates all the stream-like syntax (filter/map/sort)

(It also isn't a bukkit syntax)

@Absolutionism
Copy link
Contributor

I apologize, I suffer from “I didn’t see that and I’m dumb” syndrome

Copy link
Member

@APickledWalrus APickledWalrus left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Pull request adding a new feature.

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

5 participants