PartialFunctions.:<|Method
<|(f, args)

Applies a function to the succeeding argument or tuple of arguments. Acts as the reverse of |>, and is especially useful when combined with partial functions for an alternative, low-parenthese function chaining syntax

Examples

julia> using PartialFunctions

julia> isdigit <| '1'
true

julia> (+) <| (2, 3)...
5

julia> map $ Int <| [1.0, 2.0, 3.0]
3-element Vector{Int64}:
 1
 2
 3
source
PartialFunctions.flipMethod
flip(f::Function)

Creates a function which takes arguments in backwards order from f, that is last argument first, and so on. Returns a PartialFunctions.ReversedFunction{typeof(f)}. Flipping a ReversedFunction returns the original function.

Examples

julia> firstsecond(first, second) = (first = first, second = second)
firstsecond (generic function with 1 method)

julia> firstsecond("First thing", "Second thing")
(first = "First thing", second = "Second thing")

julia> using PartialFunctions

julia> secondfirst = flip(firstsecond);

julia> secondfirst("First thing", "Second thing")
(first = "Second thing", second = "First thing")
source
PartialFunctions.@$Macro
@$ f(args...; kwargs...)

Partially apply the given arguments to f. Unknown arguments are represented by _.

Note

If no _ is present, the function is executed immediately.

Examples

julia> matmul(A, X, B; C = 1) = A * X .+ B .* C
matmul (generic function with 1 method)

julia> A = randn(2, 2); B = rand(2, 2); X = randn(2, 2);

julia> pf = @$ matmul(_, X, _; C = 2)
matmul(_, X, _; C = 2)

julia> pf(A, B) ≈ matmul(A, X, B; C = 2)
true
source