jackfirth / rebellion

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

Shuffling and reservoir sampling #555

Closed jackfirth closed 2 months ago

jackfirth commented 2 months ago

I'd like a (shuffling) transducer that's like shuffle from racket/list, but a transducer. I'd also like a (sampling k) transducer that's equivalent to (shuffling) followed by (taking k), but which uses some reservoir sampling algorithm to run in O(k) space instead of O(n) space.

jackfirth commented 2 months ago

I'm gonna punt on reservoir sampling for now since it's much more complicated to implement.