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

Function captures #78

Closed
lpil opened this issue Feb 27, 2019 · 2 comments
Closed

Function captures #78

lpil opened this issue Feb 27, 2019 · 2 comments
Milestone

Comments

@lpil
Copy link
Member

lpil commented Feb 27, 2019

foo(_, 1)

Is equivalent to

fn(x) { foo(x, 1) }
@lpil lpil added this to the v0.1 milestone Feb 27, 2019
@OvermindDL1
Copy link

OvermindDL1 commented Feb 28, 2019

I supported that format in my MLElixir project as well for explicit partial application as well, however I also supported _1, _2, _3, etc... for repositioning arguments as well, like via foo(_3, a, _1, _2, b) became fun a1 a2 a3 -> foo(a3, a, a1, a2, b). I found it very useful. :-)

EDIT: You could mix and match them as well, the _'s just took whatever missing _#'s as expected, though honestly I wouldn't support that, only one form or the other in a given partial application, would be useful for partial applications inside partial applications then.

@lpil
Copy link
Member Author

lpil commented Feb 28, 2019

That's a nice suggestion, thanks!

@lpil lpil mentioned this issue Mar 2, 2019
@lpil lpil closed this as completed Mar 4, 2019
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