DelayedEvaluation

Build Status

DelayedEvaluation

This package extends the functionality of Base.Fix1 and Base.Fix2 to any function and provide a syntax to build DelayEval objects via getindex for callable objects, similar to DataFrames indexing. To achieve this, this package relies on type piracy, defining Base.getindex for Base.Callable.

Usage

Simply index a function using a ! as a placeholder where arguments will be supplied on call. Examples:

sin[1.0]() == sin(1.0)

map[:,[1,2,3]](x->x+1) = map(x->x+1,[1,2,3])

Keyword arguments are also supported

sort[by=x->x[1]]([(2,:a),(1,:b)]) == sort([(2,:a),(1,:b)]; by=x->x[1])

sort[by=x->x[1]]([(2,:a),(1,:b)]; by=x->x[2]) == sort([(2,:a),(1,:b)]; by=x->x[2])