Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python any() not translated properly #34

Closed
shaolo1 opened this issue Apr 13, 2016 · 2 comments
Closed

Python any() not translated properly #34

shaolo1 opened this issue Apr 13, 2016 · 2 comments

Comments

@shaolo1
Copy link

shaolo1 commented Apr 13, 2016

Python

def is_one(val):
    return val==1
foo = [1, 2, 3]
print("any foo", any(is_one(v) for v in foo))
bar = [11, 2, 3]
print("any bar", any(is_one(v) for v in bar))

any foo True
any bar False

Converted Javascript

var is_one = function (val) {
    return val == 1;
};
var foo = list ([1, 2, 3]);
print ('any foo', any (is_one (v)vfoo));
var bar = list ([11, 2, 3]);
print ('any bar', any (is_one (v)vbar));

gets SyntaxError: missing ) after argument list

@shaolo1 shaolo1 changed the title Python any not translated properly Python any() not translated properly Apr 13, 2016
@JdeH
Copy link
Collaborator

JdeH commented Apr 14, 2016

Things like any, all and sum are not yet in. They will probably in a separate library too keep downloads small, together with other functional programming facilities. That will wait until the PY3.6 / JS6 version, since that has better support for FP concepts.

@JdeH
Copy link
Collaborator

JdeH commented Jul 18, 2016

any, all and sum have been added to the latest commit. They work both in es 5 and es 6 mode

@JdeH JdeH closed this as completed Jul 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants