Skip to content

feat: support uniqBy function#958

Open
XieChengYi wants to merge 1 commit into
expr-lang:masterfrom
XieChengYi:xiecy/support-uniqBy-func
Open

feat: support uniqBy function#958
XieChengYi wants to merge 1 commit into
expr-lang:masterfrom
XieChengYi:xiecy/support-uniqBy-func

Conversation

@XieChengYi
Copy link
Copy Markdown

Summary

  • add uniqBy(array, predicate) as a predicate builtin
  • compile uniqBy through the VM loop/accumulator path, preserving first item per unique key
  • add safe hash fast path for common keys with runtime.Equal fallback for complex keys
  • document uniqBy and cover it with builtin and public API tests

Tests

  • go test ./...

@XieChengYi
Copy link
Copy Markdown
Author

Hi maintainers, thanks for the great project.

This PR adds uniqBy(array, predicate) as a natural extension of the existing uniq builtin, following the same predicate builtin pipeline as groupBy and sortBy.

I would appreciate any feedback on the API name, docs wording, or implementation approach. Happy to adjust it to better fit the project.
@antonmedv

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant