Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting #398

Open
kcsampson opened this issue Nov 4, 2022 · 4 comments
Open

Sorting #398

kcsampson opened this issue Nov 4, 2022 · 4 comments

Comments

@kcsampson
Copy link

kcsampson commented Nov 4, 2022

I would like sort an array of objects based on a supplied function. Something like sort.Slice()

sorting := import("sorting")
myList := [{x:1}, {x:2},{x:3}]
sorting.sort( myList, func( i, j ){ return myList[i].x < myList[j].x }

The problem is, you can run a CompiledFunc for your UserFunc.

My workaround was to pass the name of a field to the UserFunc...

sorting.sort( myList, "x")

@NAICOLAS
Copy link
Contributor

@geseq Do you have any updates? :)
Would be great to be able to sort things.
Was about to sort an array of timeseries, and realized this possibility isn't available.

@rohennes
Copy link

+1!

@geseq
Copy link
Collaborator

geseq commented May 15, 2023

The author of the PR hasn’t really responded to the change request. Happy to look into this if someone else would like to pick up

@NAICOLAS
Copy link
Contributor

@ganehag Let's make this happen. :)

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

No branches or pull requests

4 participants