Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@seirl
Copy link
Contributor

@seirl seirl commented Oct 4, 2024

These list functions are used in an internal Google project, but are useful enough that they can be upstreamed to the Go implementation, and later to other runtimes.

The new functions are:

  • range() to return a list of integers from 0 to n-1.
  • reverse() to return the reverse of a list.
  • distinct() to return the unique elements in a list.
  • sortByAssociatedKeys() to sort a list by a list of keys, used to implement the sortBy() macro.

The new macros are:

  • sortBy(), used like: <listExpr>.sortBy(<elementBinding>, <keyExpression>) to sort a list by a "key expression" applied to each element, similar to l.sort(key=lambda e: keyExpression) in Python.

@seirl seirl force-pushed the list_functions branch 3 times, most recently from f55c7c6 to b83493c Compare October 4, 2024 17:24
@seirl seirl changed the title Upstream some list functions to cel-go Add functions to the lists extension. Oct 4, 2024
@seirl seirl force-pushed the list_functions branch 2 times, most recently from 066513d to 68bce0e Compare October 4, 2024 20:30
@TristonianJones
Copy link
Collaborator

/gcbrun

@seirl seirl force-pushed the list_functions branch 2 times, most recently from c42a523 to 80deafc Compare October 9, 2024 14:29
@seirl
Copy link
Contributor Author

seirl commented Oct 9, 2024

@TristonianJones Addressed all the comments, PTAL 🙂

@seirl seirl force-pushed the list_functions branch 3 times, most recently from f5b919e to 64a9920 Compare October 9, 2024 15:23
@seirl seirl requested a review from TristonianJones October 14, 2024 09:25
@seirl seirl force-pushed the list_functions branch 2 times, most recently from 0ef68b2 to f873984 Compare October 14, 2024 22:12
@seirl
Copy link
Contributor Author

seirl commented Oct 15, 2024

PTAL. Also can you confirm that you're okay with the naming for the internal sortBy function (.@sortByAssociatedKeys)?

@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones
Copy link
Collaborator

Looking pretty good, and the naming of the internal sorting function is good for me. Thanks!

@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones
Copy link
Collaborator

@seirl looking good, but we'll need to sync #1045 to fix the BUILD error

@seirl
Copy link
Contributor Author

seirl commented Oct 21, 2024

Done!

@seirl seirl requested a review from TristonianJones October 21, 2024 19:58
@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones TristonianJones merged commit bf20be9 into google:master Oct 21, 2024
2 checks passed
@seirl seirl deleted the list_functions branch October 21, 2024 21:59
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.

2 participants