dictu-lang / Dictu

Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language.
https://dictu-lang.com
MIT License
268 stars 53 forks source link

feat: add list.sortFunc #730

Closed liz3 closed 7 months ago

liz3 commented 7 months ago

feat: list.sortFunc

What's Changed:

Adds a function to list implemented in dictu which uses quickSort to allow custom sorting which is suuuper useful for a lot of problems. I would have preferred to implement this is C too but there doesn't seam to be a straight forward way to pass callbacks into c. Using a hybrid approach would have been hacky too, but of course this approach does duplicate the sorting logic.

Type of Change:

#

Housekeeping:

briandowns commented 7 months ago

LGTM

liz3 commented 7 months ago

Yeah unfortunately due to some optimisations in the VMs main loop it means it's no reentrant so using C wouldn't be possible in it's current state, just one little comment!

Is there something you wan't me to change in the PR, referencing: just one little comment!

Jason2605 commented 7 months ago

Oh what I typed out a comment 😢 it was just a note in the documentation explaining the return value of the callback and how it works essentially

liz3 commented 7 months ago

@Jason2605 done!

Jason2605 commented 7 months ago

Legend, thank you for this!