Repository navigation
add a few new commands (union, intersect, difference, permutations, combinations) - #18467
Merged
fdncred merged 2 commits intoJun 27, 2026
Merged
Conversation
Contributor
|
@fdncred I like these commands and will be definitely used by folks who work in certain areas of science, engineering and mathematics as well as computer science. Way to go ! These are good 😄 |
|
With such an extensive "stdlib" I might even try Advent of Code in |
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a few new commands
union,intersect,difference,combinations, andpermutationsas built-in filter commands. These provide immutable, functional list operations.These commands and presented as a starting point. I'm sure there are edge cases where they do not work but we can continue to work on them as time passes.
User-facing changes (Release notes)
Added some commands for set operations and combinations
Added
union,intersect,difference,combinations, andpermutationsas built-in filter commands. These provide immutable, functional list operations.Commands
unionReturns a deduplicated list of unique elements present in either the input list or the given list.
intersectReturns a deduplicated list of unique elements present in both the input list and the given list.
differenceReturns a deduplicated list of unique elements present in the input list but not in the given list.
combinationsGenerates all combinations of a given size k from the input list, streamed lazily via
ListStream. If k > n, returns an empty list.permutationsGenerates all permutations of the input list using Heap's algorithm, streamed lazily via
ListStream.Additional notes