Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
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