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
ModulePrint - function to apply prior to pretty-printing a module
Calling Sequence
module() export ModulePrint, ...; ... end module;
Description
If a module has an export or local named ModulePrint, the result of the ModulePrint() command is displayed instead of the module when a command in that module is executed.
ModulePrint is analogous to the user-defined function formatting facility described in ?print, except no arguments are passed to the formatting function.
Examples
Here we create a linked list package. The package provides the ability to create a new linked list, and prepend to an existing linked list via the New and Prepend exports. Creating a new linked list returns a module node "object".
LinkedList := module() option package; export New, Prepend; local DisplayNode; New := proc( data ) module() export Val, Next; local ModulePrint; Val := data; Next := 0; ModulePrint := proc() DisplayNode(thismodule); end proc; end module; end proc; Prepend := proc( llist, val ) local node; node := New(val); node:-Next := eval(llist); return node; end proc; DisplayNode := proc( node ) if node = 0 then return NULL; else return node:-Val, DisplayNode(node:-Next); end if; end proc; end module:
Now load the package and create a linked list. Note how the node modules get displayed. The head node is formatted by the ModulePrint command which calls DisplayNode to output the entire linked list.
See Also
module, ModuleApply, print, procedure
Download Help Document