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

Right Functional Bonding Malfunction In Map #102

Open
kckennylau opened this issue Jun 19, 2017 · 1 comment
Open

Right Functional Bonding Malfunction In Map #102

kckennylau opened this issue Jun 19, 2017 · 1 comment

Comments

@kckennylau
Copy link
Contributor

Desired Behavior

According to Functional Bonding · Cheddar Documentation, f & a is equivalent to *args -> f(*(args + [a])), meaning that (+)&1 is equivalent to a->(+)(a,1), which is equivalent to a->a+1.

How to Reproduce

print ([1,2,3].map((+)&1)) is expected to produce [2,3,4], but produced [1,3,5] instead.

@vihanb
Copy link
Member

vihanb commented Jun 19, 2017

This is desired behavior. .map produces 3 args: (item, index, array) so it's really calling (+)(item, index, array, 1). You can use => e.g.: [1,2,3]=>((+)&1) or (+:1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants