Created
May 14, 2019 05:06
-
-
Save treeowl/3e149df5a03c3ae2e51c51277919e189 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
thanks, will try to see what I can do.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know about the SO comment, but here's the GitHub issue. Remember: the function must be incremental/lazy the way
liftA2
is, and must be time and space-optimal. You will almost certainly need to mash up ideas from the internal functionsaptyMiddle
(which I created to implement(<*>)
and laterliftA2
) andapplicativeTree
(which was created, I believe by Wasserman, to implementreplicateA
and therebyreplicate
) to accomplish this mission.