Skip to content

Instantly share code, notes, and snippets.

@nonamenix
Created February 16, 2014 17:57
Show Gist options
  • Save nonamenix/9038098 to your computer and use it in GitHub Desktop.
Save nonamenix/9038098 to your computer and use it in GitHub Desktop.
CoffeeScript / Zip function for dict comprehension
zip = (pairs) ->
dict = {}
dict[key] = value for [key, value] in pairs
dict
# Example
zip ([el, el * el] for el in [4..8]) # {4:16, 5:25, 6:36, 7:49, 8:64}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment