{% hint style="info" %}
TODO: rectify ord
and chr
with REPL formatting; should results format as in the REPL?
{% endhint %}
Converts a digit character to its numeric value. For non-digit characters, it returns the ASCII value minus 48.
ord {1} == 1
ord {A} == 17
ord {a} == 49
Converts a number to its corresponding ASCII character by adding 48.
chr 48 == {0}
chr 65 == {A}
chr 97 == {a}
Checks if a character is a digit (0-9).
isDigit {0} == 1
isDigit {9} == 1
isDigit {a} == 0
Checks if a character is a hexadecimal digit (0-9, a-f, A-F).
isHexDigit {0} == 1
isHexDigit {F} == 1
isHexDigit {g} == 0
Checks if a character is uppercase.
isUpper {A} == 1
isUpper {a} == 0
isUpper {0} == 0
Checks if a character is lowercase.
isLower {a} == 1
isLower {A} == 0
isLower {0} == 0
Checks if a character is alphabetic (a-z, A-Z).
isAlpha {a} == 1
isAlpha {Z} == 1
isAlpha {0} == 0
Checks if a character is printable (space through tilde).
isPrint { } == 1
isPrint {~} == 1
isPrint {a} == 1
isPrint 0 == 0
Checks if a character is alphanumeric (a-z, A-Z, 0-9).
isAlphaNum {a} == 1
isAlphaNum {Z} == 1
isAlphaNum {0} == 1
isAlphaNum {!} == 0
Converts a character to lowercase.
toLower {A} == {a}
toLower {a} == {a}
toLower {0} == 48
Converts a character to uppercase.
toUpper {a} == {A}
toUpper {A} == {A}
toUpper {0} == 48
The ASCII code for newline (10).
newlineChar == 10
The ASCII code for tab (9).
tabChar == 9
The ASCII code for space (32).
spaceChar == 32
Converts a number to a list of digit characters.
listDigits 0 == [48 0]
listDigits 123 == [49 [50 [51 0]]]
Converts a number to a row of digit characters.
digits 0 == [48]
digits 123 == [49 50 51]
Returns the length of a string.
strLen {} == 0
strLen {abc} == 3
strLen {hello} == 5
Concatenates two strings.
strWeld {hello} { world} == {hello world}
strWeld {} {abc} == {abc}
strWeld {abc} {} == {abc}
Concatenates a row of strings.
strCat [{a} {b} {c}] == {abc}
strCat [{} {abc} {}] == {abc}
{% hint style="info" %} TODO: REPL formatting? {% endhint %}
Converts a string to a list of character codes.
strToList {abc} == [97 [98 [99 0]]]
strToList {} == 0
{% hint style="info" %} TODO: REPL formatting? {% endhint %}
Converts a list of character codes to a string.
strFromList [97 [98 [99 0]]] == {abc}
strFromList 0 == {}
{% hint style="info" %} TODO: REPL formatting? {% endhint %}
Converts a string to a row of character codes.
explode {abc} == [97 98 99]
explode {} == []
Converts a row of character codes to a string.
implode [97 98 99] == {abc}
implode [] == {}
Converts a string to uppercase.
strToUpper {Hello} == {HELLO}
strToUpper {ABC123} == {ABC123}
Converts a string to lowercase.
strToLower {Hello} == {hello}
strToLower {ABC123} == {abc123}
Capitalizes the first character of a string.
strCapitalize {hello} == {Hello}
strCapitalize {HELLO} == {HELLO}
strCapitalize {} == {}
Checks if the first character of a string is uppercase.
strIsCapitalized {Hello} == 1
strIsCapitalized {hello} == 0
strIsCapitalized {} == 0
Applies a function to every character in a string.
strMap toUpper {Hello} == {HELLO}
strMap (add 1) {ABC} == {BCD}
strMap (const {x}) {abc} == {xxx}
Checks if a string is a valid decimal literal.
isDecimalLit {123} == 1
isDecimalLit {12_34} == 1
isDecimalLit {12.34} == 0
isDecimalLit {abc} == 0
Parses a decimal literal string into a number.
loadDecimal {123} == 123
loadDecimal {12_34} == 1234
loadDecimal {0} == 0
Checks if a string is a valid hexadecimal literal (starting with "0x").
isHexLit {0xff} == 1
isHexLit {0xAB_CD} == 1
isHexLit {ff} == 0
isHexLit {0xGG} == 0
Parses a hexadecimal literal string into a number.
loadHexLit {0xff} == 255
loadHexLit {0xA_B} == 171
loadHexLit {0x0} == 0
Parses a string as either a decimal literal, hexadecimal literal, or returns the string itself.
loadKeyWord {123} == 123
loadKeyWord {0xff} == 255
loadKeyWord {abc} == {abc}