DynamicPipe.@>Macro
@>(code)

Rewrites code to create an anonymous function that takes one argument. Designed to pipe one object through multiple functions.

The functions are created using the following rules:

  1. Underscores are treated as the function argument. @> sum(_) is equivalent to x -> sum(x)
  2. If the is no underscore in the expression then then the the first argument is imputed,

@> +(3) is equivalent to x -> +(x, 3)

  1. If expression is symbol then it is treated as function so @> print is interpreted as

x -> print(x)

  1. The above 2 rules are applied to expressions separate by the pipe operator, |>. Hence

@> [_, 1, 2] |> sum() is equivalent to x -> [x, 1, 2] |> x -> sum(x)

  1. These rules also apply to macros, with the exception of @> and @>>.`
  2. The input can also be a begin end block. A separate function is created for each line in the

block with result of previous function passed into the next using the re-writing rules.

  1. If there is a sequence of pipe characters within a sequence of pipe characters then a new pipe is

is created if the first part of the pipe does not contain an underscore so @> [_, 2, sqrt(36) |> _/2] is equivalent to x -> [x, 3, sqrt(36) |> y -> y/2].

The macro can also be used in itself. Although will often require the use of brackets to get the desired effect.

Examples:

julia> 1 |>
           @>  [_ |> @>(_ + 2), 1, 1] |>
               sum
5
julia> 1 |>
           @>  begin
                [1, 1, _ |> @> +(1, 2)] 
                sum
            end
6
DynamicPipe.@>Macro
@>(code)

Rewrites code to create an anonymous function that takes one argument. Designed to pipe one object through multiple functions.

The functions are created using the following rules:

  1. Underscores are treated as the function argument. @> sum(_) is equivalent to x -> sum(x)
  2. If the is no underscore in the expression then then the the first argument is imputed,

@> +(3) is equivalent to x -> +(x, 3)

  1. If expression is symbol then it is treated as function so @> print is interpreted as

x -> print(x)

  1. The above 2 rules are applied to expressions separate by the pipe operator, |>. Hence

@> [_, 1, 2] |> sum() is equivalent to x -> [x, 1, 2] |> x -> sum(x)

  1. These rules also apply to macros, with the exception of @> and @>>.`
  2. The input can also be a begin end block. A separate function is created for each line in the

block with result of previous function passed into the next using the re-writing rules.

  1. If there is a sequence of pipe characters within a sequence of pipe characters then a new pipe is

is created if the first part of the pipe does not contain an underscore so @> [_, 2, sqrt(36) |> _/2] is equivalent to x -> [x, 3, sqrt(36) |> y -> y/2].

The macro can also be used in itself. Although will often require the use of brackets to get the desired effect.

Examples:

julia> 1 |>
           @>  [_ |> @>(_ + 2), 1, 1] |>
               sum
5
julia> 1 |>
           @>  begin
                [1, 1, _ |> @> +(1, 2)] 
                sum
            end
6
DynamicPipe.@>Macro
@>(code)

Rewrites code to create an anonymous function that takes one argument. Designed to pipe one object through multiple functions.

The functions are created using the following rules:

  1. Underscores are treated as the function argument. @> sum(_) is equivalent to x -> sum(x)
  2. If the is no underscore in the expression then then the the first argument is imputed,

@> +(3) is equivalent to x -> +(x, 3)

  1. If expression is symbol then it is treated as function so @> print is interpreted as

x -> print(x)

  1. The above 2 rules are applied to expressions separate by the pipe operator, |>. Hence

@> [_, 1, 2] |> sum() is equivalent to x -> [x, 1, 2] |> x -> sum(x)

  1. These rules also apply to macros, with the exception of @> and @>>.`
  2. The input can also be a begin end block. A separate function is created for each line in the

block with result of previous function passed into the next using the re-writing rules.

  1. If there is a sequence of pipe characters within a sequence of pipe characters then a new pipe is

is created if the first part of the pipe does not contain an underscore so @> [_, 2, sqrt(36) |> _/2] is equivalent to x -> [x, 3, sqrt(36) |> y -> y/2].

The macro can also be used in itself. Although will often require the use of brackets to get the desired effect.

Examples:

julia> 1 |>
           @>  [_ |> @>(_ + 2), 1, 1] |>
               sum
5
julia> 1 |>
           @>  begin
                [1, 1, _ |> @> +(1, 2)] 
                sum
            end
6
DynamicPipe.@>>Macro
@>>(first_arg, pipe::Expr)

Rewrites pipe into an anonymous function and passes first_arg into it. pipe must be a begin ... end block. A function is created for each line in the begin ... end block. The result of the previous function is passed into the next.

The pipe is created using the following rules:

  1. Underscores are treated as the function argument. @>> [1,2,3] begin sum(_) end is equivalent to

[1,2,3] |> x -> sum(x)

  1. If the is no underscore in the expression then then the the first argument is imputed,

@>> [1,2,3] begin .+(3) end is equivalent to [1,2,3] |> x -> .+(x, 3)

  1. If expression is a symbol then it is treated as function so @>> "hello world" begin print end is interpreted as

"hello world" |> x -> print(x)

  1. The above 2 rules are applied to each line of a begin end block. Hence
    @>> 1 begin 
        [_, 1, 2] 
        sum()
    end

is equivalent to 1 |> x -> [x, 1, 2] |> x -> sum(x)

  1. These rules also applied to macros, with the exception of @> and @>>. Hence @>> "hello world" begin @show end

is equivalent to "hello world" |> x -> @show(x )

  1. The macro can also be used in itself. If the @>> appears within itself or @> and _ is in the first

section of the pipe then it comes from the surrounding context. See the example below.

  1. If there is a sequence of pipe characters within a sequence of pipe characters then a new pipe is

is created if the first part of the pipe does not contain an underscore so

    @>> 1 begin  
        [_, 2, sqrt(36) |> _/2]
    end 
    
````
is equivalent to 1 |> x -> [x, 3, sqrt(36) |> y -> y/2]. 

Examples: 

julia-repl julia> @>> 1 begin [(@>> _ |> +(2)), 1, 1] sum end 5 ```

DynamicPipe.@>>Macro
@>>(first_arg, pipe::Expr)

Rewrites pipe into an anonymous function and passes first_arg into it. pipe must be a begin ... end block. A function is created for each line in the begin ... end block. The result of the previous function is passed into the next.

The pipe is created using the following rules:

  1. Underscores are treated as the function argument. @>> [1,2,3] begin sum(_) end is equivalent to

[1,2,3] |> x -> sum(x)

  1. If the is no underscore in the expression then then the the first argument is imputed,

@>> [1,2,3] begin .+(3) end is equivalent to [1,2,3] |> x -> .+(x, 3)

  1. If expression is a symbol then it is treated as function so @>> "hello world" begin print end is interpreted as

"hello world" |> x -> print(x)

  1. The above 2 rules are applied to each line of a begin end block. Hence
    @>> 1 begin 
        [_, 1, 2] 
        sum()
    end

is equivalent to 1 |> x -> [x, 1, 2] |> x -> sum(x)

  1. These rules also applied to macros, with the exception of @> and @>>. Hence @>> "hello world" begin @show end

is equivalent to "hello world" |> x -> @show(x )

  1. The macro can also be used in itself. If the @>> appears within itself or @> and _ is in the first

section of the pipe then it comes from the surrounding context. See the example below.

  1. If there is a sequence of pipe characters within a sequence of pipe characters then a new pipe is

is created if the first part of the pipe does not contain an underscore so

    @>> 1 begin  
        [_, 2, sqrt(36) |> _/2]
    end 
    
````
is equivalent to 1 |> x -> [x, 3, sqrt(36) |> y -> y/2]. 

Examples: 

julia-repl julia> @>> 1 begin [(@>> _ |> +(2)), 1, 1] sum end 5 ```

DynamicPipe.@>>Macro
@>>(code)

Rewrites code using the same rewriting rules as @> only the first element of the pipe is not rewritten and is instead passed through the pipe.

The functions are created using the following rules:

  1. Underscores are treated as the function argument. @>> [1,2,3] |> sum(_) is equivalent to

[1,2,3] |> x -> sum(x)

  1. If the is no underscore in the expression then then the the first argument is imputed,

@>> [1,2,3] |> .+(3) is equivalent to [1,2,3] |> x -> .+(x, 3)

  1. If expression is symbol then it is treated as function so @> "hello world" |> print is interpreted as

"hello world" |> x -> print(x)

  1. The above 2 rules are applied to expressions separated by the pipe operator, |>. Hence

@>> 1 |> [_, 1, 2] |> sum() is equivalent to 1 |> x -> [x, 1, 2] |> x -> sum(x)

  1. These rules also applied to macros, with the exception of @> and @>>. Hence @>> "hello world" |> @show

is equivalent to @>> "hello world" |> @show(_)

  1. The macro can also be used in itself. If the @>> appears within itself or @> and _ is in the first

section of the pipe then it comes from the surrounding context. See the example below.

  1. Instead of pipe characters, |>, separating the different functions that to be created a begin ... end

block can be used with and separate function is created for each line in the block. See the example below.

  1. If there is a sequence of pipe characters within a sequence of pipe characters then a new pipe is

is created if the first part of the pipe does not contain an underscore so @>> 1 |> [_, 2, sqrt(36) |> _/2] is equivalent to 1 |> x -> [x, 3, sqrt(36) |> y -> y/2].

Examples:

julia> @>> 1 |>
            [(@>> _ |> +(1, 2)), 1, 1] |>
            sum
6
julia> @>> begin 
            1 
            [(@>> _ |> _ + 2), 1, 1] 
            sum
        end
5
DynamicPipe.@>>Macro
@>>(code)

Rewrites code using the same rewriting rules as @> only the first element of the pipe is not rewritten and is instead passed through the pipe.

The functions are created using the following rules:

  1. Underscores are treated as the function argument. @>> [1,2,3] |> sum(_) is equivalent to

[1,2,3] |> x -> sum(x)

  1. If the is no underscore in the expression then then the the first argument is imputed,

@>> [1,2,3] |> .+(3) is equivalent to [1,2,3] |> x -> .+(x, 3)

  1. If expression is symbol then it is treated as function so @> "hello world" |> print is interpreted as

"hello world" |> x -> print(x)

  1. The above 2 rules are applied to expressions separated by the pipe operator, |>. Hence

@>> 1 |> [_, 1, 2] |> sum() is equivalent to 1 |> x -> [x, 1, 2] |> x -> sum(x)

  1. These rules also applied to macros, with the exception of @> and @>>. Hence @>> "hello world" |> @show

is equivalent to @>> "hello world" |> @show(_)

  1. The macro can also be used in itself. If the @>> appears within itself or @> and _ is in the first

section of the pipe then it comes from the surrounding context. See the example below.

  1. Instead of pipe characters, |>, separating the different functions that to be created a begin ... end

block can be used with and separate function is created for each line in the block. See the example below.

  1. If there is a sequence of pipe characters within a sequence of pipe characters then a new pipe is

is created if the first part of the pipe does not contain an underscore so @>> 1 |> [_, 2, sqrt(36) |> _/2] is equivalent to 1 |> x -> [x, 3, sqrt(36) |> y -> y/2].

Examples:

julia> @>> 1 |>
            [(@>> _ |> +(1, 2)), 1, 1] |>
            sum
6
julia> @>> begin 
            1 
            [(@>> _ |> _ + 2), 1, 1] 
            sum
        end
5