parse_trans/doc/ct_expand.md
2011-10-23 13:52:05 +02:00

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)