Skip to content

Add reduce/fold Expression #8353

Merged
APickledWalrus merged 15 commits intoSkriptLang:dev/featurefrom
miberss:feature/reduce
Jan 21, 2026
Merged

Add reduce/fold Expression #8353
APickledWalrus merged 15 commits intoSkriptLang:dev/featurefrom
miberss:feature/reduce

Conversation

@miberss
Copy link
Copy Markdown

@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
Copy Markdown
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

miberss and others added 2 commits January 5, 2026 23:30
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
@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
Copy Markdown
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!

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Copy link
Copy Markdown
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
Copy Markdown
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 and others added 4 commits January 7, 2026 03:22
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
Co-authored-by: Patrick Miller <apickledwalrus@icloud.com>
@miberss miberss requested a review from APickledWalrus January 7, 2026 07:16
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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!

miberss and others added 2 commits January 7, 2026 23:31
@skriptlang-automation skriptlang-automation bot added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Jan 16, 2026
@APickledWalrus APickledWalrus merged commit 7da4411 into SkriptLang:dev/feature Jan 21, 2026
10 of 13 checks passed
@skriptlang-automation skriptlang-automation bot added the completed The issue has been fully resolved and the change will be in the next Skript update. label Jan 21, 2026
@github-project-automation github-project-automation bot moved this from In Review to Done - Awaiting Release in 2.15 Releases Jan 21, 2026
@skriptlang-automation skriptlang-automation bot removed the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Jan 21, 2026
sovdeeth pushed a commit to sovdeeth/Skript that referenced this pull request Feb 9, 2026
sovdeeth added a commit that referenced this pull request Apr 2, 2026
* Add Origin-applying SyntaxRegistry (#8376)

* Add reduce/fold Expression (#8353)

* Location with Yaw/Pitch (#8351)

* Test framework: support directory resources (#8377)

* Test framework: support directory resources

* use walkFileTree

* oops forgot imports

* Pattern Stringification Customization (#8391)

* Implement StringificationProperties

* Package cleanup

* Fix missing call in GroupPatternElement stringification (#8449)

Fix GroupPatternElement stringification

* Stabilise damage source experiment (#8414)

* Stabilise damage source experiment

* Replace STABLE with MAINSTREAM

* Remove experiment from damage source test

* Remove unstable API usage supression

---------

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>

* Add vector(n) (#8412)

* Init commit

* Fix not registering overloading for old namespaces

* Standardize Module usage + add child modules (#8346)

* child module support

* Create child modules and move over existing Bukkit addon modules.

* Update newer modules

* Clean up

* Requested changes and additional conversions

Just tags left!

* convert last module

* standardize package hierarchies

* remove bad imports

* fix bad examples

* Replace ChildAddonModule with HierarchicalAddonModule, move display/interaction modules into entity module, few other requested changes

* requested changes

* varargs registrar (thanks blue!)

* Use addonmodule javadocs to point to other useful tools

* Requested Changes

* Requested Changes

* Added option to compress file backups (#8396)

* Add fast path for integer strings in variable name comparator (#8483)

* Initial conversion

* Some more conversion

* fixes

* Update StructCommand.java

* no tests

---------

Co-authored-by: Patrick Miller <apickledwalrus@icloud.com>
Co-authored-by: mibers <midaswoah2@gmail.com>
Co-authored-by: _tud <98935832+UnderscoreTud@users.noreply.github.com>
Co-authored-by: devdinc <234956748+devdinc@users.noreply.github.com>
Co-authored-by: Tiberiu Sabău <96194994+tibisabau@users.noreply.github.com>
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
Co-authored-by: Pesek <42549665+Pesekjak@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

completed The issue has been fully resolved and the change will be in the next Skript update. feature Pull request adding a new feature.

Projects

Status: Done - Awaiting Release

Development

Successfully merging this pull request may close these issues.

5 participants