Functions that print values to stdout.
Builtin(1): Prints a value and adds a newline.
print 123
; prints "123
; "
Builtin(1): Prints a value without newline.
prn 123
; prints "123"
Builtin(1): Prints a value and adds a space.
prns 123
; prints "123 "
Builtin(2): Prints a value and adds a newline.
print\val 33 "value is: {{}}"
; prints "value is: 33
; "
Builtin(1): Prints a probe of a value.
probe 33
; prints "[Integer: 33]
; "
Function that help with logical operations.
Pure Builtin(0): Returns a truthy value.
true
; returns 1
Pure Builtin(0): Returns a falsy value.
false
; returns 0
Pure Builtin(1): Turns a truthy value to a non-truthy and reverse.
not 0
; returns 1
not 1
; returns 0
Pure Builtin(2): Bitwise AND operation between two values.
1 .and 0
; returns 0
1 .and 1
; returns 1
0 .and 0
; returns 0
Pure Builtin(2): Bitwise OR operation between two values.
1 .or 0
; returns 1
1 .or 1
; returns 1
0 .or 0
; returns 0
Pure Builtin(2): Bitwise XOR operation between two values.
0 .xor 0
; returns 0
1 .xor 1
; returns 0
0 .xor 1
; returns 1
1 .xor 0
; returns 1
Builtin(1): Takes a block, if all values or expressions are truthy it returns the last one, otherwise false.
all { 1 1 1 }
; returns 1
{ 0 0 1 } .all
; returns 0
Builtin(1): Takes a block, if any of the values or expressions are truthy, the it returns that one, in none false.
any { 0 0 1 }
; returns 1
{ 0 0 0 } .any
; returns 0
Functions that mostly work with numbers.
Pure Builtin(1): Returns integer value incremented by 1.
inc 100
; returns 101
Pure Builtin(1): Returns true if integer is positive.
is-positive 1
; returns 1
0 .is-positive
; returns 0
Pure Builtin(1): Returns true if integer is zero.
is-zero 0
; returns 1
0 .is-zero
; returns 1
is-zero 0.000000
; returns 1
is-zero 0.100000
; returns 0
Pure Builtin(2): Checks if a first argument is a factor of second.
factor-of 10 2
; returns 1
10 .factor-of 3
; returns 0
Pure Builtin(1): Checks if a number is odd.
odd 3
; returns 1
Pure Builtin(1): Checks if a number is even.
even 2
; returns 1
Pure Builtin(2): Calculates module (remainder) of two integers.
3 .mod 2
; returns 1
Functions that mostly work with strings.
Pure Builtin(1): Takes a String and returns the same String, but with first character turned to upper case.
capitalize "anne"
; returns "Anne"
Pure Builtin(1): Takes a String and returns the same String, but with all characters turned to lower case.
to-lower "ANNE"
; returns "anne"
Pure Builtin(1): Takes a String and returns the same String, but with all characters turned to upper case.
to-upper "anne"
; returns "ANNE"
Pure Builtin(1): Joins Block or list of values together.
join { "Marry" "Anne" }
; returns "MarryAnne"
Pure Builtin(2): Joins Block or list of values together.
join\with { "Marry" "Anne" } ","
; returns "Marry,Anne"
Pure Builtin(2): Splits a string into a block of values using a separator
split "Marry,Anne" ","
; returns { "Marry" "Anne" }
Pure Builtin(3): Splits a line of string into values by separator by respecting quotes
split\quoted ""Marry,Anne",Joe" "," """
; returns { "Marry,Anne" "Joe" }
Pure Builtin(2): Splits a string into a block of values using a separator
split\every "abcbce" 3
; returns { "abc" "bce" }
Many of functions that work with other collections also work with strings.
Program flow control functions
Pure Builtin(2): Basic conditional. Takes a condition and a block of code.
if 1 { 101 }
; returns 101
if 0 { 101 }
; returns 0
Pure Builtin(2): Conditional if not. Takes condition and a block of code.
otherwise 1 { 101 }
; returns 0
otherwise 0 { 101 }
; returns 101
Pure Builtin(2): Basic conditional with a Returning mechanism when true. Takes a condition and a block of code.
^if 0 { 101 }
; returns 0
Pure Builtin(2): Basic conditional with a Returning mechanism when true. Takes a condition and a block of code.
^otherwise 1 { 101 }
; returns 0
Pure Builtin(3): The if/else conditional. Takes a value and true and false block of code.
either 1 { 101 } { 202 }
; returns 101
either 0 { 101 } { 202 }
; returns 202
Builtin(2): Classic switch function. Takes a word and multiple possible values and block of code to do.
switch 1 { 1 { 101 } 2 { 202 } }
; returns 101
switch 2 { 1 { 101 } 2 { 202 } }
; returns 202
Builtin(2): Similar to Case function, but checks all the cases, even after a match. It combines the outputs.
cases 1 { { 1 } { + 10 } { 1 } { + 100 } }
; returns 111
cases 1 { { 0 } { + 10 } { 1 } { + 100 } }
; returns 101
Program flow control functions
Pure Builtin(2): Basic conditional. Takes a condition and a block of code.
loop 3 { prns "x" }
; prints "x x x "
Pure Builtin(2): Conditional if not. Takes condition and a block of code.
for { 1 2 3 } { prns "x" }
; prints "x x x "
{ "a" "b" "c" } .for { .prns }
; prints "a b c "
Builtin(1): Accepts a block and does it forever.
forever { "once" .prn .return }
; prints "once"
Builtin(2):
forever\with 1 { .prn .return }
; prints "1"
Functions that do code and evaluate blocks.
Builtin(1): Takes a block of code and does (runs) it.
do { 101 + 101 }
; returns 202
Builtin(2): Takes a Context and a Block. It Does a block inside a given Context.
cc: context { x: 101 } do-in cc { x + 101 }
; returns 202
Builtin(2): Takes a value and a block of code. It does the code with the value injected.
1 .with { + 100 }
; returns 101
Builtin(1): Takes a block of code and does (runs) it.
try { 10 + unknown } |type?
; returns error
Builtin(2): Takes a Context and a Block. It Does a block inside a given Context.
ctx: context { x: 101 } do-in\try ctx { x / 0 } |type?
; returns error
Builtin(1): Takes a block of Rye values and evaluates each value or expression.
x: 101 vals { x }
; returns { 101 }
name: "Anne" vals { name "Goodall" }
; returns { "Anne" "Goodall" }
y: 202 vals { 101 y y + 101 }
; returns { 101 202 303 }
Builtin(2): Evaluate a block with injecting the first argument.
vals\with 100 { + 1 }
; returns { 101 }
Builtin(1): Accepts a block, does it and times it's execution time.
time-it { 1 + 1 }
; returns 0
Functions that create functions.
Pure Builtin(1): Creates a function without arguments.
f: does { prns "Hey" } f f
; prints "Hey Hey "
Pure Builtin(2): Creates a function.
f: fn { x } { prns x } f "A" f "B"
; prints "A B "
Pure Builtin(1): Creates a function that accepts one anonymouse argument.
f: fn1 { .prns } f "A" f "B"
; prints "A B "
Pure Builtin(2): Creates a pure function.
add10: pfn { x } { x + 10 } add10 9
; returns 19
x: 10 f: pfn { } { prns 1 } try { f } |type?
; returns error
x: 10 f: pfn { } { x } try { f } |type?
; returns error
Pure functions only have access to other pure functions.
Pure Builtin(2): Creates a function with specific context.
x: 10 cl: fn { } { prns x } , context { x: 99 cl }
; prints "99 "
x: 10 cl: closure { } { prns x } , context { x: 99 cl }
; prints "10 "