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

& shorthand function failure case #390

Closed
vans163 opened this issue Sep 6, 2017 · 0 comments · Fixed by #393
Closed

& shorthand function failure case #390

vans163 opened this issue Sep 6, 2017 · 0 comments · Fixed by #393
Labels
Milestone

Comments

@vans163
Copy link
Contributor

vans163 commented Sep 6, 2017

orders = [%{email: "test@hotmail.com"},%{email: "test2@hotmail.com"}]

#Bad no crash but values are all undefined
options = Enum.reduce(orders, [],
    &(&2++[[:option, %{value: &1.email}, &1.email]]))
Console.log(options)

#Good
options = Enum.reduce(orders, [],
    fn(o,a)-> a++[[:option, %{value: o.email}, o.email]] end)
Console.log(options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants