This is a convenience function for AFL generation.
afl(..., envir = parent.frame())
In the ellipsis arg, any R functions right after a pipe sign `|“ is converted to a scidb operator of the same name. All regular functions are first evaluated in the calling environment, and then convereted to strings depending on the result types. ArrayOp => ArrayOp$to_afl(), v:NonEmptyVector => paste(v, collapse=','), NULL is ignored.
The environment where expressions are evaluated. Default: the calling env.
AFL string
Any a | op_name(b)
call will be translated to op_name(a, b)
in R, then translated to AFL:
op_name(a, b)
Any a | op_name
call will be translated to op_name(a)
in R, then translated to AFL:
op_name(a)
Where a
, b
can be any ArrayOpBase instance, array name or array opertion or AFL expression;
op_name
can be any scidb operator or function name.
Using this syntax, we can chain multiple AFL operators
E.g.1. 'array' | filter('a > 3 and b < 4') | project('a', 'b')
will be translated into: project(filter(array, a > 3 and b < 4), 'a', 'b')
E.g.2.'array' | filter(a > 3) | op_count
=> op_count(filter(array, a > 3))