Hi Adrian, that's the way it works now for now, single-input single-output 
functions only, |> may be even deprecated in the future since type 
inference doesn't work well at all for now, it's going to be removed from 
Base it seems. Currying/function chaining has been discussed a lot at 
GitHub.

Here is a pull request I made to make what you want possible (it contains 
links to several other similar discussions at GitHub), since I also just 
expected it to work:

* https://github.com/JuliaLang/julia/pull/14476

You can see my solution (and other peoples solutions) there and decide 
whether to use it or not yourself.



El martes, 29 de diciembre de 2015, 11:02:09 (UTC-6), Adrian Salceanu 
escribió:
>
> I'm a bit puzzled by the behavior of the pipe operator when feeding values 
> to functions expecting multiple arguments. Basically it doesn't seem to 
> work at all. Am I missing something? 
>
> Ex: 
>
> julia> function show_off(x, y)
>        println(x)
>        println(y)
>        end
> show_off (generic function with 1 method)
>
>
> julia> show_off(1, 2)
> 1
> 2
>
>
> julia> 1 |> show_off(2)
> ERROR: MethodError: `show_off` has no method matching show_off(::Int64)
> Closest candidates are:
>   show_off(::Any, ::Any)
>
>
> julia> 1,2 |> show_off
> ERROR: MethodError: `show_off` has no method matching show_off(::Int64)
> Closest candidates are:
>   show_off(::Any, ::Any)
>  in |> at operators.jl:198
>
>
> julia> (1,2) |> show_off
> ERROR: MethodError: `show_off` has no method matching show_off(::Tuple{
> Int64,Int64})
> Closest candidates are:
>   show_off(::Any, ::Any)
>  in |> at operators.jl:198
>
>

Reply via email to