Skip to content

Type introspection

boolean?(value)

Return true when the given value is a boolean.

float?(value)

Return true when the given value is a float.

integer?(value)

Return true when the given value is a integer.

list?(value)

Return true when the given value is a list.

map?(value)

Return true when the given value is a map.

number?(value)

Return true when the given value is a number (an integer or a float)

Examples:

$> number?(1.1)
true
$> number?(10)
true
$> number?("lala")
false

string?(value)

Return true when the given value is a string.

tuple?(value)

Return true when the given value is a tuple.

typeof(v)

Return the type of the given argument, as a string

Examples:

$> typeof "hello"
"string"
$> typeof [1, 2, 3]
"list"
$> typeof %{type: "x"}
"map"
$> typeof {1, 2}
"tuple"
$> typeof true
"boolean"
$> typeof nil
nil
$> typeof 1.1
"float"
$> typeof 10
"integer"