API Documentation
GeneratedExpressions.generate
โ Functiongenerate(body, pre_substitution; eval_module, tl_opts)
Expand and evaluate parametrized expression comprehensions.
!!! Note that in expressions, $sym
atoms have to be escaped as
:(sym)`.
Examples
generate("{$a+$b, a=1:3, b=3:5, dlm=+, zip=true}")
generate(:({:($a)+:($b)+:($c), a=1:3, b=3:5, dlm=+, zip=true}), Dict(:c=>2))
GeneratedExpressions.@fileval
โ Macro@fileval <path> <global opts> <substitutions (singleton range)>
Expand and evaluate parametrized expression comprehensions in a file, and evaluate the resulting expression. Use mode=string
to process the input as a string (which is then parsed and evaluated).
Examples
@fileval "file.jl" mode=expr x=1 # treat contents of "file.jl" as expression (parse first, then expand)
@fileval file_string.jl mode=string x=1 # first expand as string, then
GeneratedExpressions.@generate
โ Macro@generate {<expression body>, <substitution ranges>, <local generator opts>} <generator opts>
@generate "{<<expression body>>, <substitution ranges>, <local generator opts>}" <generator opts>
Expand and evaluate parametrized expression comprehensions.
!!! When using the string form, an expression body containing a comma has to be escaped by another pair of angle brackets (<
and >
).
Examples
@generate {$a+$b, a=1:3, b=3:5, dlm=+, zip=true} eval_macros=true
@generate "{$a+$b, a=1:3, b=3:5, dlm=+, zip=true}"
a=b=c=1; @generate {$[a,b,c], dlm=+}
a=b=c=1; @generate("{<$[a,b,c]>, dlm=+}")