Misty Programming Language:

Intrinsic Constants And Functions

These are constants and functions that are predefined in the language that are available to all modules and processes. The names of the constants and functions are not reserved. What that means is that Misty programs may reuse these names, but doing so gives up access to the intrinsics. This gives two benefits:

Constants

false

This is the value of 1 = 0. The false value is one of the two logical values.

true

This is the value of 1 = 1. The true value is one of the two logical values.

null

This is the value of 1 / 0. The null value is an empty immutable object. All attempts to obtain a value from null by refinement will produce null.

Any attempt to modify null will disrupt. Any attempt to call null as a function will disrupt.

null is the value of missing arguments, missing fields in records, and invalid numbers. The |default operator can detect the presence of null and substitute another value.

pi

This is an approximation of the circle expression circumference / diameter, or to be precisely approximate, 3.1415926535897932.

Creator Functions

The creator functions are used to make new objects. Some of them can take various types. All of these functions can return null if their inputs are not suitable.

Array

array(number)

Make an array. All of the elements are initialized to null.

number is a non-negative integer, the intended length of the new array.

array(number, initial_value)

Make an array. All of the elements are initialized to initial_value.

number is a non-negative integer, the intended length of the new array.

If initial_value is a function, then the function is called for each element to produce initialization values. If the function has an arity of 1 or more, it will be passed the element number.

array(array)

Copy. Make a mutable copy of the attay.

array(array, function, reverse, exit)

Map. Call the function with each element of the array, collecting the return values in a new array. The function is passed each element and its element number.

ƒ function(element, element_nr)

If reverse is true, then it starts with the last element and works backwards.

If exit is not null, then when the function returns the exit value, then the array function returns early. The exit value will not be stored into the new array. If the array was processed normally, then the returned array will be shorter than the input array. If the array was processed in reverse, then the returned array will have the same length as the input array, and the first elements will be null.

This is like the for function except that the return values are collected into a new array.

array(array, another_array)

Concat. Produce a new array that concatenates the array and another_array.

array(array, from, to)

Slice. Make a mutable copy of all or part of an array.

array: the array to copy

from: the position at which to start copying. Default: 0, the beginning. If negative, add length(array).

to: the position at which to stop copying. Default: length(array), the end. If negative, add length(array).

If, after adjustment, from and to are not valid integers in the proper range, then it return null. from must be positive and less than or equal to to. to must be less than or equal to length(array).

array(record)

Keys. Make an array containing all of the text keys in the record. The keys are not guaranteed to be in any particular order. Record keys are not included.

array(text)

Split into composite characters. A composite character is a Unicode character and its succeeding combining characters, if any.

array(text, separator)

Split the text into an array of subtexts. The separator can be a text or pattern.

array(text, length)

Dice the text into an array of subtexts of a given length.

Logical

logical(value)

if value = 0 \/ value = false \/ value = "false"
    return false
if value = 1 \/ value = true \/ value = "true"
    return true
return null

Number

number(logical)

The result will be 1 or 0.

number(number)

The number is returned.

number(text, radix)

Convert a text to a number. The optional radix is an integer between 2 and 37. (See Base 32.) The default radix is 10.

number(text, format)

format radix separator decimal point
"" 10   .period
"n"
"u" _underbar
"d" ,comma
"s"  space
"v" .period ,comma
"l" dependent on locale
"i" _underbar
"b" 2
"o" 8
"h" 16
"t" 32
"j" 0x- base 16
0o- base 8
0b- base 2
otherwise base 10

The number function converts a text into a number.

If it is unable to (possibly because of a formatting error), it returns null. The format character determines how the text is interpreted. If the format is not one of those listed, then null is returned.

Examples:

set result: number("123,456,789.10", "d")    # result is 123456789.1
set result: number("123.456.789,10", "v")    # result is 123456789.1
set result: number("123.456.789,10", "d")    # result is null
set result: number("123 456 789.10", "s")    # result is 123456789.1
set result: number("12.350")                 # result is 12.35
set result: number("12.350", "v")            # result is 12350
set result: number("12.350", "i")            # result is null
set result: number("666")                    # result is 666
set result: number("666", "b")               # result is null
set result: number("666", "o")               # result is 438
set result: number("666", "h")               # result is 1638
set result: number("666", "t")               # result is 6342
set result: number("0666")                   # result is 666

Record

record(record)

Copy. Make a mutable copy.

record(record, array_of_keys)

Select. Make a new record containing only the fields that are named by the array_of_keys.

record(array_of_keys)

Set. Make a record using the array as the source of the keys. Each field value is true.

record(array_of_keys, value)

Value Set. Make a record using the array as the source of the keys. Each field value is value.

record(array_of_keys, function)

Functional Value Set. Make a record using the array as the source of the keys. The function is called for each key, yielding the field values.

Text

text(array)

Convert an array to text. The array can contain text and unicode codepoints. All will be concatenated together to make a single text.

text(array, separator)

Convert an array to text. The array can contain text and unicode codepoints. All will be concatenated together to make a single text. The separator text is inserted between each piece.

text(number, radix)

Convert a number to text. The optional radix is an integer 2 and 37. (See Base 32.) The default radix is 10.

text(number, format)

The format of the format text is

format format_separation format_style format_places

format_separation "" digit

format_style 'b' 'e' 'h' 'i' 'j' 'n' 'l' 'o' 's' 't' 'u' 'v'

format_places digit digit digit

The text method converts a number to a text. It takes a format text parameter.

A format text contains a style letter that controls how a text is produced from the number. It is optionally preceded by a separation digit, and optionally followed by a places digit. There are real styles and integer styles. If the format parameter is not a proper format text, then null will be returned.

Separation is a character that is placed between digits to improve readability. If separation is 0, then there is no separation. If separation is 3, then a character will be inserted before the quadrillions, trillions, billions, millions, and thousands.

Places is the number of places to display after the decimal point (in real styles) or the minimum number of digits to display with zero-fill (in integer styles). If places is 0, then as many digits as necessary are displayed. Places can be zero or one or two digits.

real style default
separation
default
places
decimal
point
separator
e exponential 0 0 .period  
n number
s space 3  space
u underbar _underbar
d decimal 2 ,comma
v comma ,comma .period
l locale determined by the locale

The real format options are

"e" uses scientific notation. One digit will be placed before the decimal point, and all of the remaining digits after, followed by e and the exponent.

"n" uses .period as the decimal point and no separator. It is the format used for numbers in Misty source programs and JSON. Scientific notation will be used if the number value is extreme.

"s" uses .period as the decimal point and a space as the separator.

"u" uses .period as the decimal point and _underbar as the separator.

"d" uses .period as the decimal point and ,comma as the separator.

"c" uses ,comma as the decimal point and .period as the separator.

"l" depends on the locale to determine the characters to use as the decimal point and the separator.

The optional places determines the number of digits after the decimal point. The default is determined by the format, as seen in the table. If the places is 0, then the number of decimal places will be the fewest to exactly display the number without truncating. If the places is larger, then the field will be padded if necessary with trailing 0.

The optional separation determines the spacing of the separator character. For example, to place a separator between billions, millions, and thousands (that is, every 3 digits) then separation should be 3. If separation is zero, then there is no separation. The default is determined by the style.

integer style base default
separation
minimum
places
separator
i integer 10 0 1 _underbar
b binary 2
o octal 8
h hexadecimal 16
t Base32 32

The integer styles first trunc the number. The fractional part of the number is ignored. The separation character is _underbar.

The optional places determines the minimum number of digits to show. More leading 0 may be shown if necessary. The default is determined by the format, as seen in the table.

The optional separation determines the spacing of the separator character. For example, to place a separator between billions, millions, and thousands (that is, every 3 digits) then separation should be 3. If separation is zero, then there is no separation. The default is determined by the format, as seen in the table.

Examples:

def data: 0123456789.1
set result: text(data)            # result is "123456789.1"
set result: text(data, "n")       # result is "123456789.1"
set result: text(data, "3s4")     # result is "123 456 789.1000"
set result: text(data, "s")       # result is "123 456 789.1"
set result: text(data, "d2")      # result is "123,456,789.10"
set result: text(data, "4d0")     # result is "1,2345,6789.1"
set result: text(data, "v2")      # result is "123.456.789,10"
set result: text(data, "e")       # result is "1.234567891e8"
set result: text(data, "e4")      # result is "1.2345e8"
set result: text(data, "i")       # result is "123456789"
set result: text(data, "8b")      # result is "111_01011011_11001101_00010101"
set result: text(data, "o")       # result is "726746425"
set result: text(data, "h")       # result is "75BCD15"
set result: text(data, "t")       # result is "3NQK8N"
set result: text(12)              # result is "12"
set result: text(12, 8)           # result is "14"
set result: text(12, 32)          # result is "C"
set result: text(12, "4b8")       # result is "0000_1100"
set result: text(12, "o3")        # result is "014"
set result: text(12, "h4")        # result is "000C"
set result: text(12, "t2")        # result is "0C"

text(text)

Return the text.

text(text, from, to)

Make a copy of part of a text.

text: the text to copy.

from: the position at which to start copying. Default: 0, the beginning. If negative, add length(text).

to: the position at which to stop copying. Default: length(array), the end. If negative, add length(text).

If, after adjustment, from and to are not valid integers in the proper range, then it returns null. from must be positive and less than or equal to to. to must be less than or equal to length(array).

set my_text: "miskatonic"
text(my_text, 0, 3)        # "mis"        # the first 3
text(my_text, 3, 6)        # "kat"        # from 3 to 6
text(my_text, 5)           # "tonic"      # exclude the first 5
text(my_text, 0, -4)       # "miskat"     # exclude the last 4
text(my_text, -3)          # "nic"        # the last 3
text(my_text, 0, 0)        # ""
text(my_text, 10)          # ""
text(my_text, 11)          # null
text(my_text, 2, 1)        # null

Sensory Functions

The sensory functions end with ?question mark. They always return a logical.

process?(value)

Is this an process?

process?(@)            # true
process?("process")    # false

array?(value)

Is this an array? If the operand is an array, the result is true. Otherwise, the result is false.

array?(0)                              # false
array?({})                             # false
array?([])                             # true
not(array?([]))                        # false
array?(¶ (1- {letter digit "_-%"}))    # false
array?(null)                           # false
array?("array")                        # false

blob?(value)

Is this a blob? If the operand is a blob, the result is true. Otherwise, the result is false.

blob?(0)        # false
blob?("blob")   # false
blob?(blob())   # true

character?(value)

Is this a character? If the operand is a text with a length of 1, then the result is true. Otherwise, the result is false.

character?(1)            # false
character?("1")          # true
character?("character")  # false
character?("")           # false
character?("\u{FFFE}")   # true
character?()             # false
character?(«"»)          # true
character?(null)         # false

data?(value)

Is this data? If the operand is a text, number, logical, array, blob, or record, then the result is true. If the operand is a function, pattern, or null, the result is false.

data?(0)           # true
data?("")          # true
data?(["0"])       # true
data?({})          # true
data?(null)        # false

digit?(value)

Is this a digit? If the operand is a text with a length of 1 and is one of the 10 digit characters, then the result is true. Otherwise, the result is false.

digit?(0)           # false
digit?("0")         # true
digit?("9")         # true
digit?("09")        # false
digit?("digit")     # false
digit?("")          # false
digit?(1)           # false
digit?(["0"])       # false
digit?("Z")         # false

false?(value)

Is the value false?

fit?(number)

Is the number a fit number? A number is a fit number if it is an integer that fits in 56 bits. All fit numbers are integers in the range -36028797018963968 thru 36028797018963967. Only fit numbers can be given to the fit functions. Misty has additional integers that are too big to fit.

function?(value)

Is this a function? If the operand is a function, then the result is true. Otherwise, the result is false.

function?(0)                # false
function?(ƒ () (null))      # true
function?("function")       # false
function?(null)             # false
function?(function?)        # true

integer?(value)

Is this an integer? If the operand is a number and if its fraction part is zero, then the result is true. Otherwise, the result is false.

integer?(0)                    # true
integer?(13 / 4)               # false
integer?(16 / 4)               # true
integer?(65.0000000)           # true
integer?(65.0000001)           # false
integer?(null)                 # false
integer?(true)                 # false
integer?(1)                    # true
integer?(36028797018963968)    # true
integer?(1.00001e100)          # true

letter?(value)

Is this a letter? If the operand is a text with a length of 1 and is a letter, then the result is true. Otherwise, the result is false.

letter?(0)          # false
letter?("0")        # false
letter?("letter")   # false
letter?("l")        # true
letter?("L")        # true
letter?("")         # false
letter?(null)       # false

logical?(value)

Is this a logical? A logical is either a false or a true. All other values are not logical.

logical?(false)    # true
logical?(true)     # true
logical?(0)        # false
logical?()         # false
logical?(null)     # false

lower?(value)

Is this a lower case letter? If the operand is a text with a length of 1 and is a lower case letter, then the result is true. Otherwise, the result is false.

lower?(0)         # false
lower?("0")       # false
lower?("lower")   # false
lower?("l")       # true
lower?("L")       # false
lower?("")        # false

null?(value)

Is the value null?

number?(value)

Is this a number? If the operand is a number, then the result is true. Otherwise, the result is false.

number?(0)           # true
number?((13 / 4))    # true
number?((13 / 0))    # false
number?(98.6)        # true
number?("0")         # false
number?(1)           # true

pattern?(value)

Is this a pattern? If the operand is a pattern, then the result is true. Otherwise, the result is false.

pattern?(¶ (1- {letter digit "_-%"}))    # true

record?(value)

Is this a record? If the operand is a record, then the result is true. Otherwise, the result is false.

record?(0)                              # false
record?({})                             # true
record?([])                             # false
record?("record")                       # false
record?("{}")                           # false
record?(ƒ () ({}))                      # false
record?(¶ (1- {letter digit "_-%"}))    # false

text?(value)

Is this a text? If the operand is a text, then the result is true. Otherwise, the result is false.

text?(0)           # false
text?("0")         # true
text?("number")    # true
text?("")          # true
text?(null)        # false

true?(value)

Is the value true?

upper?(value)

Is this an upper case letter? If the operand is a text with a length of 1 and is an upper case letter, then the result is true. Otherwise, the result is false.

upper?(0)          # false
upper?("0")        # false
upper?("UPPER")    # false
upper?("u")        # false
upper?("U")        # true
upper?("")         # false

whitespace?(value)

Is this whitespace? If the operand is a nonempty text containing only whitespace characters, then the result is true. Otherwise, the result is false.

whitespace?(0)          # false
whitespace?(32)         # false
whitespace?(char(32))   # true
whitespace?("0")        # false
whitespace?(" ")        # true
whitespace?("\t")       # true
whitespace?("\r")       # true
whitespace?("\r\n")     # true
whitespace?("space")    # false
whitespace?("     ")    # true
whitespace?(" L")       # false
whitespace?("")         # false

Standard Functions

abs(number)

Absolute value. Return the positive form of the number. If the argument is not a number, the result is null.

apply(function, array)

Apply. Execute the function and return its return value. Pass the elements of the array as arguments. See proxy.

If the first argument is not a function, apply returns its first argument.

If length(array) is greater than 4, it disrupts.

If the second argment is not an array, it is used as a single argument.

ceiling(number, place)

If place is 0 or null, the number is rounded up to the smallest integer that is greater than or equal to the number. If place is a small positive integer, then the number is rounded up to that decimal place.

Examples:

set result: ceiling(12.3775, 0)      # result is 13
set result: ceiling(12.3775, -2)     # result is 12.38
set result: ceiling(-12.3775)        # result is -12
set result: ceiling(-12.3775, -2)    # result is -12.37
set result: ceiling(-12.3775)        # result is -13

character(value)

If the value is a text, it returns the first character. If the value is a non-negative 32-bit integer, it returns the character from that codepoint. Otherwise, it returns the empty string.

codepoint(text)

The codepoint function returns the first codepoint in a text as a number. If the argument is not a text, or if it is the empty text, then it returns null.

extract(text, pattern, from, to)

The text is matched to the pattern. If it does not match, the result is null. If the pattern does match, then the result is a record containing the saved fields.

filter(array, function)

The filter function calls a function for every element in the array, passing each element andits element number.

ƒ function(element, element_nr)

When the function's return value is true, then the element is copied into a new array. If the function's return value is false, then the element is not copied into the new array. If the return value is not a logical, then the filter returns null.

It returns a new array. The length of the new array is between 0 thru length(array). It returns null if the function parameter is not a function.

Example:

def data: [0, 1.25, 2, 3.5, 4, 5.75]
def integers: filter(data, integer?)    # integers is [0, 2, 4]

find(array, function, reverse, from)

Call the function for each element of the array, passing each element and its element number.

ƒ function(element, element_nr)

If the function returns true, then find returns the element number of the current element.

If the second argument is not a function, then it will be compared exactly to the elements.

If the reverse argument is true, then search begins at the end of the array and works backward.

The from argument gives the element number to search first. The default is 0 unless reverse is true, when the default is length(array) - 1.

find returns the element number of the found value. If nothing is found, find returns null.

floor(number, place)

If place is 0 or null, the number is rounded down to the greatest integer that is less than or equal to the number. If place is a small positive integer, then the number is rounded down to that many decimal places. For positive numbers, this is like discarding decimal places.

Examples:

set result: floor(12.3775)         # result is 12
set result: floor(12.3775, -2)     # result is 12.37
set result: floor(-12.3775, 0)     # result is -13
set result: floor(-12.3775, -2)    # result is -12.38

for(array, function, reverse, exit)

For each. Call the function with each element of the array. The function is passed each element and its element number.

ƒ function(element, element_nr)

If reverse is true, then it starts with the last element and works backwards.

If exit is not null, then when the function returns the exit value, then the for function returns early. The exit value is usually true or false, but it may be anything. If exit is null, then every element is processed.

The for function returns null unless it did an early exit, when it returns the exit value.

format(text, collection, transformer)

The format function makes a new text with substitutions in an original text. A collection is either an array of texts or a record of texts.

A search is made for {left brace and }right brace in the text. If they are found, the middle text between them is examined. If the collection is an array, the middle text is used as a number, and then the matched {left brace and middle and }right brace are replaced with the text at that subscript in the array. If the collection is a record, and if the middle text is the key of a member of the collection with a text value, then the value of the member is used in the substitution. Unmatched text is not altered.

The text between {left brace and }right brace will be broken on the :colon character. The left text will be used as a number or name to select a value from the collection. (The value need not be a text.)

If a transformer parameter is a function, then it will be called with the collection[left text] and right text as parameters. If it returns a text, then the substitution is made.

If a transformer parameter is a record, then the right text will be used to select a function from the transformer. That function will be passed the value from the collection. If the return value is a text, that text will substitute. If there is no colon, then the empty text will be used to select the function from the transformer. If the transformer does not produce a function, or if the function does not return a text, then no replacement occurs. If transformer[right text](collection[left text]) produces a text, then the substituation will be made.

If the substitution is not made, and if collection[left text] is a number, then the right text is used as a format parameter in calling collection[left text].text(right text). If it returns a text, then the substitution is made.

Example:

var result: format("{0} in {1}!", ["Malmborg", "Plano"])
    # result is "Malmborg in Plano!"

fraction(number)

The fraction function returns the fractional part of a number It returns null for non-numbers.

integer(number)

The integer function returns the integer part. It returns null for non-numbers.

length(value)

The length function
value result
array number of elements
blob number of bits
logical null
function number of named parameters
null null
number null
record record.length()
text number of codepoints

Length. Find the length of an array, a blob, or a text in elements, bits, or characters. For functions, it is the arity (or maximum number of arguments).

If the value is a record containing a length field containing a function, then length(my_record) has the same effect as my_record.length().

All other values produce null.

lower(text)

The lower function returns a text in which all uppercase characters are converted to lowercase.

Example:

set result: lower("Carl Hollywood")    # result is "carl hollywood"

max(number, number)

Maximum. The result is the larger of the two numbers. If either argument is not a number, the result is null.

max(3, 4)             # 4

max can be used with min to constrain values within an acceptable range.

min(max(2, 3), 7)     # 3
min(max(4, 3), 7)     # 4
min(max(8, 3), 7)     # 7
max(1, null)          # null
max(null, 1)          # null

min(number,number)

Minimum. The result is the smaller of the two numbers. If either argument is not a number, the result is null.

min(3, 4)            # 3

modulo(dividend, divisor)

The result of modulo(dividend, divisor) is dividend - (divisor * floor(dividend / divisor)). The result has the sign of the divisor.

If dividend is 0, then the result is 0. If divisor is 0, or if either operand is not a number, then the result is null. dividend and divisor are not required to be integers.

If both arguments are integers, and if the divisor is a positive power of two, then it is the same as and(dividend, divisor - 1).

neg(number)

Negate. Reverse the sign of a number. If the argument is not a number, the result is null. Note that the -minus sign is not used as a prefix negation operator.

not(logical)

Not. Return the opposite logical. If the argument is not a logical, it returns null.

reduce(array, function, initial, reverse)

The reduce function takes a function that takes two arguments and returns a value.

ƒ function(zeroth, wunth)

The function will be called for each element of the array, passing the result of the previous iteration to the next iteration.

The initial value is optional. If present, the function will be called for every element of the array.

If initial is null:

If initial is not null:

If reverse is true, then the work will begin at the end of the array and work backward.

Example:

def data: [1, 2, 3, 4, 5, 6, 7, 8, 9]
def total: reduce(data, ƒ+)      # total is 45
def product: reduce(data, ƒ*)    # product is 362880

remainder(dividend, divisor)

For fit integers, the remainder is dividend -((dividend ÷ divisor) * divisor).

replace(text, target, replacement, limit)

Return a new text in which the target is replaced by the replacement.

text: the source text.

target: a text or pattern that should be replaced in the source.

replacement: text to replace the matched text, or a function that takes the matched text and the starting position, and returns the replacement text or null if it should be left alone.

limit: The maximum number of replacements. The default is all possible replacements. The limit includes null matches.

reverse(array)

The reverse method makes a new array with the elements in the opposite order.

It returns a new, reversed array.

Example:

def data: ["I", "am", "Sam"]
def result: reverse(data)    # the result is ["Sam", "am", "I"]

round(number, place)

If place is 0 or null, the number is rounded to the nearest integer. If place is a small integer, then the number is rounded to that many decimal places.

Examples:

round(12.3775)         # 12
round(12.3775, -2)     # 12.38
round(-12.3775, 0)     # -12
round(-12.3775, 1)     # -10
round(-12.3775, 2)     # 0
round(-12.3775, -2)    # -12.38

Search the text for the target. If the target is found, return the character position of the left-most part of the match. If the search fails, return null.

text: the source text.

target: a text or pattern that should be found in the source.

from: The starting position for the search. The default is 0, the beginning of the text. If from is negative, it is added to length(text).

sign(number)

The sign function returns -1 if the number is negative, 0 if the number is exactly 0, 1 if the number is positive, and null if it is not a number.

sort(array, select)

The sort function produces a new array in which the values are sorted. Sort keys must be either all numbers or all texts. Any other type of key or any error in the key calculation will cause the sort to fail, returning null. The sort is ascending. The sort is stable, so the relative order of equal keys is preserved.

The optional select parameter determines how the sort key for each element is selected.

select type Sort key for array[index] Description
null array[index] The sort key is the element itself. This is useful for sorting simple arrays of numbers or texts.
text array[index][select] The sort key is the select field of each record element. This is useful for sorting arrays of records.
number array[index][select] The sort key is the select element of each array element. This is useful for sorting arrays of arrays.
array select[index] select is a parallel array containing the sort keys.

It returns a new, sorted array.

Examples:

def foods: ["oats", "peas", "beans", "barley"]
def result: sort(foods)    # result is ["barley", "beans", "oats", "peas"]

var stooges: [
    {first: "Moe", last: "Howard"}
    {first: "Joe", last: "DeRita"}
    {first: "Shemp", last: "Howard"}
    {first: "Larry", last: "Fine"}
    {first: "Joe", last: "Besser"}
    {first: "Curly", last: "Howard"}
]
set stooges: sort(sort(stooges, "first"), "last")
    # stooges is now [
    #     {first: "Joe", last: "Besser"}
    #     {first: "Joe", last: "DeRita"}
    #     {first: "Larry", last: "Fine"}
    #     {first: "Curly", last: "Howard"}
    #     {first: "Moe", last: "Howard"}
    #     {first: "Shemp", last: "Howard"}
    # ]
set stooges: sort(stooges, [50, 60, 20, 40, 10, 30])
    # stooges is now [
    #     {first: "Moe", last: "Howard"}
    #     {first: "Larry", last: "Fine"}
    #     {first: "Shemp", last: "Howard"}
    #     {first: "Curly", last: "Howard"}
    #     {first: "Joe", last: "Besser"}
    #     {first: "Joe", last: "DeRita"}
    # ]

trim(text, reject)

The trim function removes selected characters from the ends of a text. The default is to remove control characters and spaces.

set result: "  Hello   there   ".trim()    # result is "Hello   there"

trunc(number, place)

The number will be truncated toward zero. If the number is positive, the result is the same as floor(place). If the number is negative, the result is the same as ceiling(place).

If place is a small integer, then the number is rounded down to that many decimal places. This is like discarding decimal places.

Examples:

set result: trunc(12.3775, 0)     # result is 12
set result: trunc(12.3775, 2)     # result is 12.37
set result: trunc(-12.3775)       # result is -12
set result: trunc(-12.3775, 2)    # result is -12.37

turkish_lower(text)

Similar to lower, except that I goes to ıdotless i.

turkish_upper(text)

Similar to upper, except that i goes to İI dot.

upper(text)

The upper function returns a text in which all lowercase characters are converted to uppercase.

Example:

set result: upper("Carl Hollywood")    # result is "CARL HOLLYWOOD"