Link Search Menu Expand Document

Basic Functions

def (or =)

Builtin

Variable assignment, define a variable in the current scope.

; Strings
def {VARIABLE_NAME} "example string"
; Numbers
def {VARIABLE_NAME} 32
; Using =
= {VARIABLE_NAME} "another string"

fun

StdLib

Allows function definition in the current scope.

fun {FUNCTION_NAME} {FUNCTION_BODY}

if

Builtin

Conditional statement, if the first expression evaluates to True (1) than the first statement will be evaluated otherwise the second statement is.

(if (True) 
    {print "This always happens"} 
    {print "This never happens"})
This always happens

tail

Builtin

Remove first item/digit/character from a list/number/string and return the result. (Note: When used on numbers if the result would begin with zero, the leading zeros will be omitted.)

(tail "Walther PPK")
(tail 1234)
(tail (list "Aston" "Martin"))
(tail 1010)
"alther PPK"
234
{"Martin"}
10

Builtin

Similar to tail, operates on a list/number/string and instead returns the first item/digit/character

(head "Walther PPK")
(head 1234)
(head (list "Aston" "Martin"))
"W"
1
{"Aston"}

join

Builtin

join combines two or more lists or strings into a single list or string.

(join (list "item1" "item2") (list "item3" "item4"))
(join "Hello" "," " " "World" "!")
{"item1" "item2" "item3" "item4"}
"Hello, World!"

list

Builtin

list creates a list from all the consequent items provided to it.

(list "item 1" "item 2" 3)
{"item 1" "item 2" 3}

type

Builtin

type returns a number that corresponds with the type of the item passed to it. See type_num for translations or use type_string to get a string instead.

(type "example")
(type_string "example")
1
"String"

\ (lambda)

Builtin

Lambda allows the creation of anonymous functions, useful when paired with functions like filter.

(\ {STRING} {print STRING})

length

Builtin

length returns the number of characters in a string, the number of digits in a number, or the number of elements in a list depending on what is passed into it.

(length "Bond")
(length 1234)
(length (list 1 2 3 4))
4
4
4

flipargs

StdLib

flipargs flips the order of two arugments and returns a new function that can consume them in that order.

(fun {sub_function a b} {- a b})
(flipargs sub_function 10 20)
(sub_function 10 20)
10
-10