Map as a partial function


Currently in Julia v0.7.0 we have

julia> [1,2,3] |> map(x->x*x)
ERROR: MethodError: no method matching (::getfield(Main, Symbol("##3#4")))()
Closest candidates are:
  #3(::Any) at REPL[0]:1
 [1] map(::getfield(Main, Symbol("##3#4"))) at .\abstractarray.jl:2033
 [2] top-level scope at none:0

But if I define

julia> = Base.Fix1(,f)

the results are

julia> [1,2,3] |> map(x->x*x)
3-element Array{Int64,1}:

The latter seems useful.
Any change map(f::Function) = Fix1(map,f) could be added to Base.operators.jl ?


I think the long-term plan is to have syntax for partial application, see

for a recent discussion.


Why not

[1,2,3] .|> x->x^2


That works. Clever and more straight forward. Didn’t know you could do that.


I’ve been noticing more and more that broadcast has been replacing many traditional uses of map. Obviously, they’re not completely equivalent, but for the large number of cases where they are, broadcast seems to be the emerging consensus of the Julia community (and, as far as I know, one of the first examples of a uniquely “Julian” style).