https://github.com/fnj/hose.jl
Hose.jl - when pipe is just not flexible enough
https://github.com/fnj/hose.jl
julia piping
Last synced: 3 months ago
JSON representation
Hose.jl - when pipe is just not flexible enough
- Host: GitHub
- URL: https://github.com/fnj/hose.jl
- Owner: FNj
- License: mit
- Created: 2018-10-13T17:26:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-28T10:05:08.000Z (almost 5 years ago)
- Last Synced: 2025-03-18T19:36:08.087Z (3 months ago)
- Topics: julia, piping
- Language: Julia
- Homepage:
- Size: 6.84 KB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hose.jl
[](https://travis-ci.org/FNj/Hose.jl)
**Hose.jl** is for the situations where pipe is just not flexible enough.
```julia
@hose(expression)
```
The `@hose` macro processes its argument so that you pipe the left hand side (LHS) into functions of several arguments, macros, blocks, just index the LHS etc. The placeholder symbol for the LHS on the RHS is the underscore (`_`).Examples:
```julia
@hose a |> b(x, _) # produces b(x, a)
@hose a |> _[b] # produces a[b]
@hose a |> @testmacro _ b # equivalent of @testmacro(a, b)
```Also behaves like [Lazy.jl](https://github.com/MikeInnes/Lazy.jl) `@>` macro:
```julia
@hose a |> b(x) # produces b(a, x)
@hose a |> @testmacro # produces equivalent of @testmacro(a)
```Standard piping works as well. For other examples see `test/runtests.jl`.
Kudos to [Pipe.jl](https://github.com/oxinabox/Pipe.jl) which I basically shamelessly forked for creating this package.