mirror of
https://github.com/valitydev/parse_trans.git
synced 2024-11-06 08:35:17 +00:00
1.5 KiB
1.5 KiB
#Module ct_expand#
Compile-time expansion utility.
Authors: : Ulf Wiger (ulf.wiger@erlang-solutions.com
).
##Description##
This module serves as an example of parse_trans-based transforms,
but might also be a useful utility in its own right.
The transform searches for calls to the pseudo-function
ct_expand:term(Expr)
, and then replaces the call site with the
result of evaluating Expr
at compile-time.
For example, the line
ct_expand:term(lists:sort([3,5,2,1,4]))
would be expanded at compile-time to [1,2,3,4,5]
.
##Data Types##
###form()##
form() = any()
###forms()##
forms() = [[form()](#type-form)]
###options()##
options() = [{atom(), any()}]
##Function Index##
parse_transform/2 |
##Function Details##
###parse_transform/2##
parse_transform(Forms::[forms()](#type-forms), Options::[options()](#type-options)) -> [forms()](#type-forms)