Closed soegaard closed 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:
(vector-permute vec p) == (permute p vec)
(list-permute lst p) == (permute p lst #:into into-list)
(string-permute str p) == (permute p str #:into into-string)
I want to eliminate the type-specific permutation functions to keep the API simple. What do you think?
A general permute
sounds like an excellent idea.
Note that
immutable?
returns#f
for lists, so there is noimmutable?
in the contract forlist-permute
.