Hi Ismael, 

I understand, thanks for your answer. I like the proposed solution, I'll 
give it a try. 

It's strange that the pipe operator won't work with type inference, seems 
to be working great with F#. However, comparing with F#, I can see how 
currying and partial function application can be more problematic, as 
technically (if I understood correctly) Julia functions / methods always 
take just one argument, a tuple. But this is even more reason to expect to 
be able to feed a tuple into the pipe operator and just work. 

I personally would love to see more support for the pipe operator and 
currying and partial function application to get rid of some of the 
parenthesis. 

- A


marți, 29 decembrie 2015, 18:17:21 UTC+1, Ismael Venegas Castelló a scris:
>
> 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