Skip to content

Instantly share code, notes, and snippets.

@bga
Created November 28, 2010 21:32
Show Gist options
  • Save bga/719318 to your computer and use it in GitHub Desktop.
Save bga/719318 to your computer and use it in GitHub Desktop.
var a = [x*2 for each (x in [1,2,3])];
var a = [1,2,3].map(_("x -> 2*x"));
var b = [x*2 for each (x in [1,2,3]) if (x>1)];
var a = [1,2,3].filter(_("x -> x > 1")).map(_("x -> 2*x"));
var c = [x+y
for each (x in [1,2,3])
for each (y in [10,20,30])
if (x>1)
];
var c = Array._zip({
x: [1,2,3].filter(_("x -> x > 1"),
y: [10,20,30]
}).map(_("v -> v.x + v.y")
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment