Skip to content

Instantly share code, notes, and snippets.

@treeowl
Created May 14, 2019 05:06

Revisions

  1. treeowl created this gist May 14, 2019.
    8 changes: 8 additions & 0 deletions ZipRev.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    zipRev :: [a] -> [b] -> [(a,b)]
    zipRev xs ys = fr where
    (fr, allbs) = go [] allbs xs ys

    go acc ~(b':bs') (a:as) (b:bs) = ((a,b') : res, bss)
    where
    (res, bss) = go (b:acc) bs' as bs
    go acc _ _ _ = ([], acc)