Post #2735426
2026-05-11 08:11 UTC
@byorgey@mathstodon.xyz I call that operator "long zip with", or `lzw` for short. It's in my Underappreciated Unfold paper (1998), but also in my dissertation (1991).
Replies (1)
-
@jer_gib@functional.cafe 2026-05-11 08:20
@byorgey@mathstodon.xyz Your way is a fold. There's also (of course!) an unfold: ``` transpose :: [[a]] -> [[a]] transpose = unfoldr next where next xss | any null xss = Nothing | otherwise = Just (map head xss, map tail xss) ``` That works for rectangular arrays. Coping also with upper left triangular ones needs a bit more work.