-
Notifications
You must be signed in to change notification settings - Fork 16
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
Approach for nesting a map #45
Comments
I was thinking along similar lines, I've been testing out things in this branch https://github.com/jkrumbiegel/Chain.jl/tree/function-chain Your proposed syntax doesn't work, you can always test such things by prefacing the code with The @chain "a|x\nb| y z " begin
strip
split("\n")
@chain map() do
split("|")
@chain map() do
strip
split
end
end
end This would then work for arbitrary functions like filter, etc, that take a closure as the first argument which itself expects one argument. I even thought about transforming any |
That looks really good. I'd be more than happy to test it over the next few days.
Your sense is obv better than mine — but I don't think it'd be possible to have ambiguity, given that |
Yes for |
Related to #42 (comment) & #44
Is there a recommended approach for nesting a map? This would allow arbitrary nesting in a single point-free expression — something that's really difficult in languages I've explored.
For example, if we wanted to use @chain for the whole expression, it would currently look something like:
But the
x
andy
aren't needed here! Assuming there isn't an existing recommended approach — could we extent Chain to handle those too, with feature for reducingmap(_) do x; @chain x begin
down to something likemap @chain do
, so we could have:I'm not sure of the exact form that's both concise and idiomatic — I don't have a view on the exact syntax. And feel free to say this is a bad idea... Thanks again.
The text was updated successfully, but these errors were encountered: