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 `transposing` transducer #506

Closed jackfirth closed 3 years ago

jackfirth commented 3 years ago

Given a list of lists, a common Racket idiom to transpose the lists is (apply map list list-of-lists). This transforms '((1 2 3) (a b c) (x y z)) into '((1 a x) (2 b y) (3 c z)). This pull request adds a transposing transducer that generalizes this operation to any sequence of sequences, allowing one to transpose a list-of-sequences into a vector-of-vectors, for example.