[BangPypers] List Comprehensions Vs. map/filter (Was: if not with comparision statement in python)
Dhananjay Nene
dhananjay.nene at gmail.com
Tue Aug 2 06:29:30 CEST 2011
On Mon, Aug 1, 2011 at 8:30 PM, Anand Chitipothu <anandology at gmail.com> wrote:
> I was trying to translate Python list-comprehensions into Javascript
> and here is what I've come up with.
>
> $pyjs.listcomp(
> function(x, y, z) { return [x, y, z]},
> [
> range(1, 100),
> function(x) { return range(x, 100)},
> function(x, y) { return range(y, 100)},
> ],
> function(x, y, z) { return x*x + y*y == z*z;}
> )
>
> I haven't worked out the $pyjs.listcomp function implementation yet.
>
There's another one you might want to take a look at
http://rosettacode.org/wiki/List_comprehensions#JavaScript
More information about the BangPypers
mailing list