PropertyFunctions.PropertyFunctionType
struct PropertyFunction <: Function

Use only for dispatch in special cases. User code should not create instances of PropertyFunction directly - use the @fp macro instead.

The type parameters of PropertyFunction are subject to change and not part of the public API of the PropertyFunctions package.

PropertyFunctions.filterbyFunction
filterby([getindex|view,] f)

Generates a function that filters a table-like array by f, returning either a copy (default) or a view (ignored if the object does not support views).

Example:

xs = [0.9, 0.1, 0.9, 0.2, 0.7, 0.0, 0.7, 0.5, 0.2, 0.6]
xs |> filterby(x -> x < 0.5)
PropertyFunctions.sortbyFunction
sortby(
    [getindex|view,]
    f;
    alg::SortAlg = Base.DEFAULT_STABLE, 
    rev::Bool = false,
    order::Ordr = Base.Order.Forward
)

Generates a function that sorts and array by f, returning either a copy (default) or a view (ignored if the object does not support views).

Example:

xs = [0.9, 0.1, 0.9, 0.2, 0.7, 0.0, 0.7, 0.5, 0.2, 0.6]
xs |> sortby(x -> (x - 0.5)^2)
PropertyFunctions.@pfMacro
@pf expression

Generates a function that accesses the properties of it's argument referenced via $property in expression.

@pf($a + $c^2) is equivalent to x -> x.a + x.c^2.

Examples:

xs = StructArrays.StructArray((
    a = [0.9, 0.1, 0.9, 0.2, 0.7, 0.0, 0.7, 0.5, 0.2, 0.6],
    b = [0.1, 0.5, 0.9, 0.9, 0.9, 0.6, 0.1, 0.9, 0.8, 0.2],
    c = [0.4, 0.1, 0.4, 0.1, 0.9, 0.2, 0.4, 0.8, 0.0, 0.1]
))

@pf($a + $c^2)(xs[1])
xs .|> @pf $a + $c^2

Broadcasting specializations try to ensure that only the columns referenced via $colname in expr will be read, reducing memory traffic. So data.b will not be accessed in the example above.

@pf is also very handy in sortby and filterby:

xs |> sortby(@pf $a + $c^2)
xs |> filterby(@pf $a + $c^2 < 0.5)