[1,2,3] |> f. doesn't work



Try this:

f(x) = x^2
[1,2,3] |> f.

with the dot, to map f over the array. It doesn’t work. Is this intended?


Just got an explanation for this. The . affects .( ), not f.
Maybe one could define .|> for this usage? I think it would be convenient.


f.(args...) is equivalent to broadcast(f, args...), but f. by itself does not define a function. (Think of the . as modifying the function call operation (...) and not f.)

It should indeed be possible to do x .|> f at some point (hopefully 0.6): this should be equivalent to broadcast(|>, x, f), which should do what you want. Currently, my PR for dotted operations (https://github.com/JuliaLang/julia/pull/17623) doesn’t handle |>, but I should probably add this.


Okay, I just added this to my #17623 PR; [1,2,3] .|> (x->x+1) now works. :smiley:


Great! Looking forward to 0.6.