I was wondering what the prospects were of this being resurrected for 1.2. I notice it was on the milestones, but it seemed to me there was a bit of skepticism and I’m not sure what its status is.
I have to admit, I have an irrationally strong desire to have this, and I would probably use it all the time (likely to the point of abuse).
1.x releases happen on a schedule. (IIRC every 4 months?)
Since at any point in time master both builds and does not contain any breaking changes.
What ever is in master at that point in time, is going to be in 1.x.
This is in contrast to 0.x releases which were basically planned major releases.
Each release was done when all the desired features were done.
As such the question of if X will be in a release is less one of planning,
and more one of what gets done.
I too am irrationally eager to have this. I think it’s especially nice for the simple cases where it streamlines the expression considerably. In the more complicated cases, one might as well use ordinary notation.
I was initially (irrationally? ) eager for this, then after reading about and digesting the corner cases I realized that I would almost always prefer lambdas: for simple cases they work fine, for complex cases I would be scratching my head about corner cases of _ syntax.
I think we came to a rough consensus on what the rule should be, but it still needs to be implemented. (The current PR implements a simpler rule, but we decided on something a bit more ambitious to make it easier to use binary/unary operators.) I haven’t gotten around to working on it.
I’m still not sure I understand what the edge cases are that would cause so much ambiguity, but I do think that the way Base and much of the Julia package ecosystem are written promote the tendency to reach for this feature quite often, especially in it’s simplest form. I find myself quite frequently making calls like
findall(myfunction(a, _, c), iter)
or
sort!(x, by=myfunction(_, b))
Unless I’m missing something big, those are not cases that cause much ambiguity, and occur frequently. Those examples look a lot cleaner and more readable than x -> myfunction(a, x) to me. (Not to mention that it’s only it’s not until 1.2 that we get the remaining relational operator currying).
Anyway, if I’m reading the sentiment right, it’s sounding like nobody is entirely opposed to the existence of this feature, so sounds like we’ll have it eventually, even if not in 1.2.
I don’t have much to add here except that I’m also extremely eager to have something like this. I got so used to piping everything in R (which, you may agree or disagree with, but I Love) that I really miss it when I’m working with Julia.
Could you summarise what those rules would be, or point to a comment in the issue that summarises them? I haven’t been keeping up and didn’t see in a quick skim.
You can cover quite a few cases with a partial function. Then try to write your functions so the thing you most often want to “curry” is first in the parameter list. Which is the case for many functions ( map, reduce, etc ). I also have a swap function if it happens to be in the second position.
Has anyone tried Elixir’s way to do short anonymous functions? It looks like &(&1 + &2) for (x,y) -> x+y. So, where the expression stops is pretty explicit.