\define allows to define new operators. It is inspired by the
well-known #define
of the C/C++ preprocessor. The aim
of this operator is to create a new operator based on other ones. It
can also be used to change name of operators. This way, we can
imagine to translate all Doodle operators in other foreign languages.
But in fact, this usage is certainly not the most interesting.
Indeed, this operator make the Doodle language open and extensible.
We can also imagine macro operators definition compounding several
operators in one.
\define take two global parameters :
\define replaces all occurrences of its first parameter (new
operator name) by the second one (block of Doodle source code). New
operator parameters are substituted and used inside the Doodle code.
The replacement is purely lexical.
This operator can only be found outside of a block (step or header).
\define \def {\define} % for lazy people ... \define \titre(t) {\title(t)} % french operator translation
\define OPERATOR (PARAMETERS) { DOODLE_CODE }
OPERATOR Description : Indicates the new operator name. Type : Operator name. Allowed values : Any valid operator name : starting with a backslash character (\). PARAMETERS (optional) Description : Indicates the list of parameters taken by the new operator. Type : List of identifier. Allowed values : Any sequence of identifiers separated by a coma (,). Note : If no parameter are required, parenthesis are removed. DOODLE_CODE Description : Indicates the Doodle code by which an occurrence of the new operator should be replaced. Type : Piece of Doodle code. Allowed values : Any valid Doodle source code.