Reference
Casting
To number
| Input | An argument of any type. |
|---|---|
| Output | The argument converted to a number. |
Signature
to_number(a: Any): NumberExample
to_number("42") // returns 42To integer
| Input | An argument of any type. |
|---|---|
| Output | The argument converted to an integer. |
Signature
to_integer(a: Any): NumberExample
to_integer(3.7) // returns 3To decimal
| Input | An argument of any type. |
|---|---|
| Output | The argument converted to a decimal number. |
Signature
to_decimal(a: Any): NumberExample
to_decimal("3.14") // returns 3.14To string
| Input | An argument of any type. |
|---|---|
| Output | The argument converted to a string. |
Signature
to_string(a: Any): StringExample
to_string(42) // returns "42"To boolean
| Input | A string, number, or boolean. Strings convert to true if non-empty after trimming. Numbers convert to true if non-zero. Booleans pass through unchanged. Other types throw an error. |
|---|---|
| Output | The argument converted to a boolean. |
Signature
to_boolean(a: Any): BooleanExample
to_boolean(1) // returns trueTo list
| Input | A set, vector, stack, or queue. Other types throw an error. |
|---|---|
| Output | The argument converted to a list. |
Signature
to_list(a: Any): ListExample
to_list(set_new([1, 2, 3])) // returns [1, 2, 3]Is number
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a number. False otherwise. |
Signature
is_number(a: Any): BooleanExample
is_number(42) // returns trueIs integer
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is an integer. False otherwise. |
Signature
is_integer(a: Any): BooleanExample
is_integer(3) // returns trueIs decimal
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a decimal number. False otherwise. |
Signature
is_decimal(a: Any): BooleanExample
is_decimal(3.14) // returns trueIs infinite
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is infinite. False otherwise. |
Signature
is_infinite(a: Any): BooleanExample
is_infinite(num_infinity()) // returns trueIs string
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a string. False otherwise. |
Signature
is_string(a: Any): BooleanExample
is_string("hello") // returns trueIs boolean
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a boolean. False otherwise. |
Signature
is_boolean(a: Any): BooleanExample
is_boolean(true) // returns trueIs timestamp
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a timestamp. False otherwise. |
Signature
is_timestamp(a: Any): BooleanExample
is_timestamp(time_now()) // returns trueIs function
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a function. False otherwise. |
Signature
is_function(a: Any): BooleanExample
is_function(num_add) // returns trueIs list
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a list. False otherwise. |
Signature
is_list(a: Any): BooleanExample
is_list([1, 2, 3]) // returns trueIs map
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a map. False otherwise. |
Signature
is_map(a: Any): BooleanExample
is_map({"a": 1}) // returns trueIs vector
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a vector. False otherwise. |
Signature
is_vector(a: Any): BooleanExample
is_vector(vector_new([1, 2])) // returns trueIs set
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a set. False otherwise. |
Signature
is_set(a: Any): BooleanExample
is_set(set_new([1, 2])) // returns trueIs stack
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a stack. False otherwise. |
Signature
is_stack(a: Any): BooleanExample
is_stack(stack_new([1, 2])) // returns trueIs queue
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a queue. False otherwise. |
Signature
is_queue(a: Any): BooleanExample
is_queue(queue_new([1, 2])) // returns trueIs file
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a file. False otherwise. |
Signature
is_file(a: Any): BooleanExample
is_file(file_fromPath("data.txt")) // returns trueIs directory
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a directory. False otherwise. |
Signature
is_directory(a: Any): BooleanExample
is_directory(directory_fromPath("/home")) // returns trueIs duration
| Input | An argument of any type. |
|---|---|
| Output | True if the argument is a duration. False otherwise. |
Signature
is_duration(a: Any): BooleanExample
is_duration(duration_fromHours(2)) // returns true