String Operations

Strings are textual values enclosed in double quotes, for example: “hello world”. They are a fundamental data type and can be manipulated with various language operations.

Creating strings

To create a string, simply write it between double quotes:

"hello world"
"123"
"foo bar baz"

String operations

split

The split operation divides a string into substrings separated by spaces (or by a specific delimiter with split(delim)). Each substring is pushed onto the stack as a new string.

Example:

"hello world stack" split => "hello" "world" "stack"
"a,b,c" "," split => "a" "b" "c"

compress

The compress operation transforms a sequence of strings on the stack into a single concatenated string, separating values with a space.

Example:

"hello" "world" compress => "hello world"

compose

The compose operation can also be used with strings to concatenate them:

"foo" "bar" compose => "foobar"

Other examples

"one two three" split => "one" "two" "three"
"a-b-c" "-" split => "a" "b" "c"
"a" "b" "c" compress => "a b c"
"a" "b" compose => "ab"

Note: Strings can also be used as arguments for other operations, such as save, load, or as keys for user-defined instructions.