Chain.jl
Chain.jl copied to clipboard
Splat
Adds support for splatted functions. Specifically, implement the following parsing rules:
splat(f)(args...)-->f(firstargs..., args...);splat(f)(args..., _)-->f(args, _...).
Of course, args... can be empty and there can be as many _ as desired.
Hi, thank you for the PR!
Why do you think splat(f) plus special parsing rule is preferable to f(_...,)? It seems much shorter to me and doesn't add any complexity.
As splat(f) can be stored in a variable g, using g in the chain would then have different behavior which I don't really like.
Hi!
First of all thank you for your great package :smile:
It is just a code pattern that I use a lot. I thought I would propose it as other people might like it but at the end of the day, it is a matter of personal preference. It just feels natural for 1-argument higher-order functions calls (like splat(f)) to be parsed that way but again, that's very personal.
As for your second point I agree with you. Maybe it would be better for consistency's sake to use a "macro" kinda like @aside to tag statements for special parsing?
Anyway, feel free to do whatever you think is best with this PR!