Skip to content

Instantly share code, notes, and snippets.

@dwickstrom
Last active July 6, 2017 09:34
Show Gist options
  • Save dwickstrom/0a419fa7240595685d7394315d7af350 to your computer and use it in GitHub Desktop.
Save dwickstrom/0a419fa7240595685d7394315d7af350 to your computer and use it in GitHub Desktop.
Zip impl
//+ zip :: [a] -> [b] -> [(a, b)]
const zip = ([x, ...xs]) => ([y, ...ys]) =>
[[x, y], ...zip (xs) (ys)]
const zip = xs => ys =>
xs.reduce((acc, curr, idx) =>
[[curr, ys[idx]], ...acc], [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment