& (prefix suffix -- text)
Inputs
Outputs
text: Concatenation result.
This builtin is the text-concatenation operator. Both inputs must be known, non-NIL Text objects at compile time, so the result is also a known Text object. Unknown Text objects and known NIL Text objects are rejected.
Known multi-line text is formed by combining & with LF.
Behavior
- If
suffixis empty, the builtin reusesprefixas the result. - If
prefixis empty, the builtin reusessuffixas the result. - If both inputs are non-empty, the builtin creates a new known Text object containing the concatenated UTF-8 code units.
- The builtin does not split, normalize, or reinterpret text. It concatenates the UTF-8 byte sequences exactly as supplied.
Example
{} 0 {} [
"-- concat --" printCompilerMessage
"pre" "fix" & printStack _:;
"-- empty prefix --" printCompilerMessage
"" "fix" & printStack _:;
"-- empty suffix --" printCompilerMessage
"pre" "" & printStack _:;
0
] "main" exportFunction
Expected Output During Compilation
-- concat --
"prefix"
-- empty prefix --
"fix"
-- empty suffix --
"pre"
See also
LFbuiltin(-- lineFeed)Pushes a line-feed Text constant.attributebuiltin(attribute --)Consumes one known Text attribute string and produces nothing.textSizebuiltin(text -- size)Returns the UTF-8 code-unit (byte) count of a Text object as known or unknown Natx; knownNILtext is invalid.textSplitbuiltin(text -- characterList)Splits known Text by decoded UTF-8 characters into one-character Text items. Empty text yields the empty Tuple().