Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
StringTools[Map] - map a Maple procedure onto a string
StringTools[AndMap] - perform mapped disjunction over a string
StringTools[OrMap] - perform mapped conjunction over a string
Calling Sequence
Map(p, s)
AndMap(p, s)
OrMap(p, s)
Parameters
p
-
anything; typically, a Maple procedure to apply to string s
s
string
Description
The Map(p, s) function applies p to each character in string s. The mapped procedure p should map characters to characters. However, if a string of length greater than one is returned in any call to p, only the first character of the returned string is used. The mapped procedure p can return an empty string to terminate the output string at that point. The result of a call to Map is the string returned by . However, Map is more efficient.
Map is a special version of map for strings. Unlike map, extra arguments included in the call to Map are not passed to the calls to p.
The AndMap(p, s) function applies p to each character in string s. If p returns the value true when applied to each character of s, AndMap returns the value true. If p returns the value false when applied to any character of s, false is returned as the final result of the call to AndMap. Otherwise, AndMap returns the result FAIL.
The characters of s are visited in order and only as many characters as are needed to determine the result of AndMap are examined.
The AndMap function computes the value
foldl( `and`, true, op( map( p, Explode( s ) ) ) )
efficiently.
The OrMap(p, s) function applies p to each character in string s and computes the conjunction of the values of p.
The result of evaluating p at each character of s is evaluated, in order, from left to right. Each call must return one of the values true, false, or FAIL. If true is returned at any call to p, the value true is returned as the result of the call to OrMap. Otherwise, if the value FAIL is returned at any call to p, FAIL is returned as the result of the call to OrMap. Otherwise, OrMap returns the result false.
Like AndMap, the OrMap procedure tests the characters of s in order, and returns as soon as it is possible to determine the final result.
These functions are part of the StringTools package, and so they can be used in the form Map(..) only after executing the command with(StringTools). However, they can always be accessed through the long form of the command by using the form StringTools[Map](..).
Examples
See Also
cat, FAIL, map, seq, string, StringTools, StringTools[Capitalize], StringTools[Explode], StringTools[IsASCII], StringTools[IsUpper], StringTools[LeftFold]
Download Help Document