macro - define a macro - abbreviation
|
Calling Sequence
|
|
macro(e1, e2,..., en)
|
|
Parameters
|
|
e[1], e[2], ..., e[n]
|
-
|
zero or more equations
|
|
|
|
|
Description
|
|
•
|
The macro facility is a simple abbreviation facility to be used when writing Maple functions and library code.
|
•
|
The effect of invoking macro(f = g) is that Maple when reading input from the terminal or a file will transform all occurrences of f on input into g except for parameters and local variables.
|
•
|
The arguments to macro are equations which are neither evaluated nor subjected to any existing macros. This means that you cannot define one macro in terms of another. You can however change the macro definition by doing macro(f = h). The command macro(f = f) will remove the macro definition for f.
|
•
|
Any Maple object, except a numerical constant, may appear on the left-hand side of f = g.
|
•
|
A typical use of the macro facility is the following. Suppose we are writing a Maple procedure that uses the Maple library routine combinat['fibonacci'] in several places, and we wish to avoid having to type this long function name every time it is used. We can define the following: macro(F=combinat['fibonacci']), and then the symbol F can be used as an abbreviation for combinat['fibonacci'] throughout the remainder of the code.
|
•
|
Macros cannot have arguments. Use procedures with option inline to achieve the effect of macros with arguments. The $define facility can also be used when source code is being redirected into the Command-line version of Maple in batch mode.
|
|
|
Thread Safety
|
|
•
|
The macro command is thread-safe as of Maple 15.
|
|
|
Download Help Document
Was this information helpful?