Skip to content

Weird behavior with syntax error: all-underscore identifier used as rvalue #3

@spirosbax

Description

@spirosbax

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions