Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
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.
For more information on thread safety, see index/threadsafe.
Examples
See Also
$define, alias, inline, subs
Download Help Document