Skip to content

A way to allow for filter, map piping... #1

@haberdashPI

Description

@haberdashPI

I like it! (Better than I like my own package LambdaFn). Thanks for putting this together!

It occurred to me that, since this is a macro, you should be able to rewrite piping expressions to treat functions as if they have a curried version.

That is:

@_  data  |>  filter(_>10) |>  map(_+1)

Could be re-written as:

data |> x -> filter(a -> a > 10, x) |> x -> map(a -> a +1,x)

The rule could be that if the top-level expression after |> is a function call, rewrite the expression to be a function that takes a single argument and passes it as the final argument of this top-level expression.

Maybe that should be a separate macro (@_> @|>, @|>_ ??). It is essentially a combination of your macro @_ and the @>> macro from Lazy.jl.

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