Weird behavior with syntax error: all-underscore identifier used as rvalue
spirosbax opened this issue · 7 comments
First of all let me say that this package has implemented almost the perfect version of the pipeline operator. Thank you. However I started using it today and noticed this very weird behavior. Observe:
Let br
be a list of elements. Countmap creates frequency => value pairs and is defined in the Statsbase package.
@hose br |> countmap |> collect .|> (x->tuple(x...)) |> sort(by=last,rev=true)
The above works as expected. Producing a sorted list of tuples in reverse order. However if I add a filter in front:
@hose br |> filter(x->x!=0,_) |> countmap |> collect .|> (x->tuple(x...)) |> sort(by=last,rev=true)
It fails with error:
syntax: all-underscore identifier used as rvalue around In[107]:1 Stacktrace: [1] top-level scope at /home/spiros/.julia/packages/IJulia/F1GUo/src/kernel.jl:52
If then, I remove the .|> operator as such:
@hose br |> filter(x->x!=0,_) |> countmap |> collect |> sort(by=last,rev=true)
It works and produces an array of pairs. It seems to me than the .|> operator and the filter function cannot coexist when using the @hose
macro.
Can you shed some light into this issue ?
Hi,
I have implemented locally a change in the code that allows for the correct use of the .|> operator. Basically I just modified the functions to recognize when the operator is a .|> rather than |> in which case it just produces broadcast(ff,target)
. I will add some tests and maybe open a pull request.
Will you have the time to review it ?
(PS. What do you think about a name change of this package? I believe that "Hose" does not indicate the functionality of the package and thus it hurts its discoverability. Maybe "Thread" would be better, inspired by Clojure's threading macro.)
Hi, what do you think about my renaming suggestion ?
Hi,
I have implemented locally a change in the code that allows for the correct use of the .|> operator. Basically I just modified the functions to recognize when the operator is a .|> rather than |> in which case it just producesbroadcast(ff,target)
. I will add some tests and maybe open a pull request.
Will you have the time to review it ?(PS. What do you think about a name change of this package? I believe that "Hose" does not indicate the functionality of the package and thus it hurts its discoverability. Maybe "Thread" would be better, inspired by Clojure's threading macro.)
I added the suggestion on the bottom of my reply from a couple of days ago.