Post #2735424
2026-05-10 20:32 UTC
@mjd@mathstodon.xyz @byorgey@mathstodon.xyz Thanks - I'll have to meditate on that!
Replies (1)
-
@byorgey@mathstodon.xyz 2026-05-10 20:53
@jer_gib@functional.cafe More concretely, what's the nicest way you know of to define `transpose`? The actual implementation in the Haskell standard library is gross. The best I've come up with is transpose = foldr (zipWithExt (++) . map pure) [] where `zipWithExt :: (a -> a -> a) -> [a] -> [a] -> [a]` is the analogue of `zipWith` which extends to the longer of its two list arguments instead of truncating to the shorter.