Top

[dup]

docstring for 'dup' function:
------------
Duplicate the top-stack element

(example)
stack: [1 2]
dup => [1 2 2]

[pop]

docstring for 'pop' function:
------------
Remove the top-stack element

(example)
stack: [1 2]
pop => [1]

[zap]

docstring for 'zap' function:
------------
Clear all the stack

(example)
stack: [1 2 3]
zap: []

[cat]

docstring for 'cat' function:
------------
Concatenate 2 values (string and quotes)

(example)
[1] [2] cat => [1 2]
"Hello, " "World!" cat => "Hello, World!"

[rotNM]

docstring for 'rotNM' function:
------------
Rotate the stack N elements M times

(example)
stack: [1 2 3]
2 1 rotNM => [1 3 2]
3 -1 rotNM => [2 3 1]

[+]

docstring for '+' function:
------------
Sum of the 2 top-stack elements

(example)
stack: [5 6]
+ => [11]

[-]

docstring for '-' function:
------------
Difference of the 2 top-stack elements

(example)
stack: [10 9]
- => [1]

[*]

docstring for '*' function:
------------
Product of the 2 top-stack elements

(example)
stack: [20 0.5]
* => [10.0]

[/]

docstring for '/' function:
------------
Quotient of the 2 top-stack elements

(example)
stack: [10 2]
/ => [5.0]

[^]

docstring for '^' function:
------------
The exponent of a number

(example)
stack: [10 2]
^ => [100]

[print]

docstring for 'print' function:
------------
Output a value (Standard output)

(example)
"Hello, World!" print => "Hello, World!"
=> []

[putstr]

docstring for 'putstr' function:
------------
Output a string value (Standard output)

(example)
"Hello!" putstr => Hello!
=> []

[putchar]

docstring for 'putchar' function:
------------
Output a char value (Standard output)

(example)
'a' putchar => a=> []

[ask]

docstring for 'ask' function:
------------
Read line from the standard input

(example)
"Your name: " ask
Your name: john
=> ["john"]

[>]

docstring for '>' function:
------------
Compare if the first value is greater than the second value

(example)
stack: [5 6]
> => [False]

[<]

docstring for '<' function:
------------
Compare if the first value is less than the second value

(example)
stack: [5 6]
< => [True]

[>=]

docstring for '>=' function:
------------
Compare if the first value is greater or equal than the second value

(example)
stack: [5 5]
>= => [True]

[<=]

docstring for '<=' function:
------------
Compare if the first value is less or equal than the second value

(example)
stack: [4 5]
<= => [True]

[and]

docstring for 'and' function:
------------
The 'AND' logic operator

(example)
True True and => [True]

[or]

docstring for 'or' function:
------------
The 'OR' logic operator

(example)
False False or => [False]

[id]

docstring for 'id' function:
------------
Get the top-stack element (does nothing)

(example)
stack: [5]
id => [5]

[str]

docstring for 'str' function:
------------
Type conversion

(example)
5 str => ["5"]

[int]

docstring for 'int' function:
------------
Type conversion

(example)
"10" int => [10]

[float]

docstring for 'float' function:
------------
Type conversion

(example)
"10.5" float => [10.5]

[bool]

docstring for 'bool' function:
------------
Convert a value to boolean value

(example)
1 Bool => [True]

[help]

docstring for 'help' function:
------------
Get a function's doc-string

(example)
[pop] help putstr
Output:
docstring for 'pop' function:
------------
Remove the top-stack element

(example)
stack: [1 2]
pop => [1]

[case]

docstring for 'case' function:
------------
Pattern matching combinator

(example)
def fact = {
[
[[0] [pop 1]]
[[_] [dup 1 - quote [dup] cat fact *]] # wildcard (match any pattern)
] case
}

def main = {
[6 dup] fact
}

[trace]

docstring for 'trace' function:
------------
Trace the Noc stack

(example)
1 2 3 trace + => stack: [1 5]
output: [1 2 3]