jackfirth / rebellion

A collection of core libraries for Racket
https://pkgs.racket-lang.org/package/rebellion
Apache License 2.0
80 stars 16 forks source link

Add list-permute #522

Closed soegaard closed 11 months ago

soegaard commented 11 months ago

Note that immutable? returns #f for lists, so there is no immutable? in the contract for list-permute.

jackfirth commented 11 months ago

@soegaard I was able to implement a permuting transducer that can permute arbitrary sequences, and using that, I made a permute function that accepts any sequence and optionally lets you customize the output reducer. Here are some equivalences:

I want to eliminate the type-specific permutation functions to keep the API simple. What do you think?

soegaard commented 11 months ago

A general permute sounds like an excellent idea.