These are constants and functions that are predefined in the language that are available to all modules and actors. 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:
This is the value of 1 = 0
. The false
value is one of the two logical values.
This is the value of 1 = 1
. The true
value is one of the two logical values.
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.
This is an approximation of the circle expression circumference /
diameter, or to be precisely approximate, 3.1415926535897932
.
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.
Make an array. All of the elements are initialized to null
.
number is a nonnegative integer, the intended length of the new array.
Make an array. All of the elements are initialized to initial_value.
number is a nonnegative 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.
Copy. Make a mutable copy of the attay.
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.
Concat. Produce a new array that concatenates the array and another_array.
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)
.
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.
Split into composite characters. A composite character is a Unicode character and its succeeding combining characters, if any.
Split the text into an array of subtexts. The separator can be a text or pattern.
Dice the text into an array of subtexts of a given length.
Make a new empty blob.
Make a new empty blob with a specific initial capacity in bits.
Make a new blob of a given length whose content is random. The random parameter is a random generator function.
Make a copy of all or part of a blob. The default of from is 0
. The default of to is the length(blob).
if value = 0 \/ value = false \/ value = "false" return false if value = 1 \/ value = true \/ value = "true" return true return null
The result will be 1
or 0
.
number(number)
The number is returned.
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 160o  base 80b  base 2otherwise 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
Copy. Make a mutable copy.
Select. Make a new record containing only the fields that are named by the array_of_keys.
Set. Make a record using the array as the source of the keys. Each field value is true
.
Value Set. Make a record using the array as the source of the keys. Each field value is value.
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.
Convert an array to text. The array can contain text and unicode codepoints. All will be concatenated together to make a single text.
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.
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
""
digitformat_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 zerofill (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 bye
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"
Return the text.
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
The sensory functions end with ?
question mark. They always return a logical.
Is this an actor?
actor?(@) # true actor?("actor") # false
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
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
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
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
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
Is the value false?
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.
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
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
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
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
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
Is the value null?
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
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
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
Is this stone? If the value is immutable, then the result is true
.
Otherwise, the result is false
. All logicals, numbers, texts,
functions, and patterns are immutable. Objects, blobs, and arrays are initially mutable,
but can be made immutable with the stone
function.
stone?(0) # true stone?("0") # true stone?([]) # false stone?({}) # false stone?(stone([])) # true stone?(stone({})) # true stone?(null) # true
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
Is the value true?
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
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
Absolute value. Return the positive form of the number. If the argument is not a number, the result is null
.
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 the second argment is not an array, it is used as a single argument.
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
If the value is a text, it returns the first character. If the value is a nonnegative 32bit integer, it returns the character from that codepoint. Otherwise, it returns the empty string.
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
.
delay(
function,
seconds)
The delay
function is used to schedule the invocation of a function at a later time. Any value returned
from the delayed invocation will be ignored. There is no guarantee that the function will ever be invoked. The delayed invocation will not interrupt
normal processing. The invocation will be delayed until the actor is
waiting for a message.
The delay
function immediately returns a cancel
function. Calling the cancel
function will cancel the delayed execution of the function, if it is not too late.
The seconds parameter determines when the invocation will occur,
no sooner than seconds seconds after now. The seconds parameter must be a nonnegative number or null
which behaves as 0
.
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.
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]
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
.
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 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.
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. The optional begin and end are texts; the defaults are "{"
and "}"
.
A search is made for the begin and end 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 begin and middle and end 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 begin and end 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!"
The fraction
function returns the fractional part of a number It returns null
for nonnumbers.
The integer
function returns the integer part. It returns null
for nonnumbers.
type  result 

array  number of elements 
blob  number of bits 
logical  null 
function  number of named parameters 
number  null 
record  null 
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). All other values produce null
.
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"
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
To determine if a value lies between two other values, uses relational operators.
if 3 ≤ value ≤ 7 set in_range: true
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
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)
.
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. Return the opposite logical. If the argument is not a logical, it returns null
.
The parallel takes a set of requestor functions and returns a requestor function that starts them all at once. It ultimately produces an array of all of the results.
The requireds and optionals are an array or record of requestor functions. Either can be null
, but not both. Otherwise, requireds and optionals must be the same type. The required requestors must all succeed if the parallel requestor is to succeed. An optional requestor can be unsuccessful without affecting the success of the whole.
A time_limit (in seconds) can be imposed.
A throttle may be used to limit the number of requestors that are running concurrently. This can be used to reduce stress on fragile systems.
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
:
length(
array)
is 0
, then it returns null
. length(
array)
is 1, then it returns array[0]
.length(
array)
is 2, it returns function(
array[0],
array[1])
. length(
array)
is 3, it returns function(
function(
array[0],
array[1])
, array[2])
. If initial is not null
:
length(
array)
is 0
, then it returns initial. length(
array)
is 1, then it returns function(initial, array[0])
.length(
array)
is 2, it returns function(function(initial,
array[0]),
array[1])
. length(
array)
is 3, it returns function(
function(function(initial,
array[0]),
array[1]),
array[2])
. 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
For fit integers, the remainder is dividend ((
dividend ÷
divisor) *
divisor)
.
, 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"]
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 leftmost 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)
.
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"} # ]
Turn an object to stone, makine the value immutable. It returns the immutable object.
The stone
function makes a value (such as a blob, array, or record) immutable. If a value contains other objects, then they will also be turned to stone. Objects that are already stone are not changed. It returns the value.
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"
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
Similar to lower
, except that I
goes to ı
dotless i.
Similar to upper
, except that i
goes to İ
I dot.
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"