 || - Help

||

the Concatenation or || Operator

 Calling Sequence a || b

Parameters

 a - name or string b - integer, name, string, or (expression)

Description

 Note: The use of this operator is discouraged. Where possible the function cat should be used.
 • The concatenation operator is a binary operator which requires a name or a string as its left operand, a. Its right operand, b, is evaluated and then concatenated (joined) to a.
 • The type (string or name) of the result is the type of the left hand operand, a.
 • If the right operand, b, evaluates to a natural integer, a string, or a name, the result of the concatenation is a name if the left operand, a, is a name and is a string if the left operand, a, is a string.
 • The right operand, b, may be a sequence of names, strings, and integers. The result is a sequence of names (strings) consisting of the catenation of the left name (string) with each element in the right sequence.
 • The right operand, b, may also be a range, in which case a sequence of names will be formed if the left operand, a, is a name. Likewise, if the left operand, a, is a string, then a sequence of strings will result.
 • For the construct name || (range) where the operands in range are integers, the result is an expression sequence consisting of the names formed by concatenating name to each integer in the specified range. If the right operand, b, in range is less than the left operand, a, then the result is the null expression sequence.
 • Ranges of characters (strings of length one) may also be used for the right operand, b. The result will be an expression sequence of strings or names, according to the type of the left operand, a.
 • If the right operand, b, evaluates to some other type of object, (e.g., a floating-point number), the result of the operation is an unevaluated concatenated object.
 • Any name returned from the concatenation operator will be a global variable.

 • The || operator is thread-safe as of Maple 15.

Examples

 > $i≔5$
 ${i}{≔}{5}$ (1)
 > $p‖i$
 ${\mathrm{p5}}$ (2)
 > $a‖\left(2i\right)$
 ${\mathrm{a10}}$ (3)

If the right-hand expression is a sequence or a range and the operands of the range are integers or character strings, then Maple returns a sequence of names.

 > $a‖\left(a,b,4,67\right)$
 ${\mathrm{aa}}{,}{\mathrm{ab}}{,}{\mathrm{a4}}{,}{\mathrm{a67}}$ (4)
 > $a‖\left(1..3\right)$
 ${\mathrm{a1}}{,}{\mathrm{a2}}{,}{\mathrm{a3}}$ (5)
 > $"foo"‖\left(1..3\right)$
 ${"foo1"}{,}{"foo2"}{,}{"foo3"}$ (6)
 > $"base"‖\left("a".."e"\right)$
 ${"basea"}{,}{"baseb"}{,}{"basec"}{,}{"based"}{,}{"basee"}$ (7)
 > $"astring"‖\mathrm{aname}$
 ${"astringaname"}$ (8)
 > $\mathrm{whattype}\left(\right)$
 ${\mathrm{string}}$ (9)
 > $\mathrm{aname}‖"astring"$
 ${\mathrm{anameastring}}$ (10)
 > $\mathrm{whattype}\left(\right)$
 ${\mathrm{symbol}}$ (11)
 > $\mathrm{aname}‖\left("a".."e"\right)$
 ${\mathrm{anamea}}{,}{\mathrm{anameb}}{,}{\mathrm{anamec}}{,}{\mathrm{anamed}}{,}{\mathrm{anamee}}$ (12)
 > $"astring"‖\left("a".."e"\right)$
 ${"astringa"}{,}{"astringb"}{,}{"astringc"}{,}{"astringd"}{,}{"astringe"}$ (13)

Note the different evaluation rules applied to the left and right operands of || :

 > $a≔"left":$
 > $b≔"right":$
 > $a‖b$
 ${\mathrm{aright}}$ (14)