all repos — min @ a0efcd6b54e03b142fdf0db7c69e11082dc1b95b

A small but practical concatenative programming language.

doc/reference.md

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
## Reference

{#op -> 
#### $1

_Signature:_ [ $2 **⇒** $3](class:kwd)

$4

 #}

### Notation

\*
: Any value.
B
: A boolean value.
{{q -> [(\*)](class:kwd)}}
: A quotation.
{{1 -> [(1)](class:kwd)}}
: The first quotation on the stack.
{{2 -> [(2)](class:kwd)}}
: The second quotation on the stack.
{{e -> [(E)](class:kwd)}}
: An error dictionary:
  <pre><code>(
    (error "MyError")
    (message "An error occurred")
    (symbol "symbol1")            ;Optional
    (filename "dir1/file1.min")   ;Optional
    (line 3)                      ;Optional
    (column 13)                   ;Optional
  )
  </code></pre>
{{s -> [S](class:kwd)}}
: A string value.
S+
: One or more string values.
{{sl -> [§](class:kwd)}}
: String-like (a string or quoted sumbol).
{{f -> [false](class:kwd)}} 
: false (boolean type).
{{t -> [true](class:kwd)}}
: true (boolean type).
{{null -> &#x2205;}}
: No value.

### `lang` Module

{#op||bind||\* §||{{null}}||
Binds the specified value (auto-quoted) to an existing symbol {{sl}}.#}

{#op||call||(\*) §||\*?||
Calls operator {{sl}} defined in scope {{q}}. #}

{#op||debug||{{null}}||{{null}}||
Toggles debug mode. #}

{#op||debug?||{{null}}||B||
Returns {{t}} if debug mode is on, {{f}} otherwise. #}

{#op||define||\* §||{{null}}||
Defines a new symbol {{sl}}, containing the specified value (auto-quoted).#}

{#op||delete||§||{{null}}||
Deletes the specified symbol {{sl}}.#}

{#op||eval||S||\*?||
Parses and interprets {{s}}. #}

{#op||exit||{{null}}||{{null}}||
Exits the program or shell. #}

{#op||format-error||(E)||S||
Formats the error {{e}} as a string.

> %sidebar%
> Example
> 
> The following: 
> 
> `((error "MyError") (message "This is a test error")) format-error`
> 
> produces: `"(!) This is a test error"`
#}

{#op||from-json||S||\*||
Converts a JSON string into {{M -> MiNiM}} data.#}

{#op||import||§||{{null}}||
Imports the a previously-loaded module {{sl}}, defining all its symbols in the current scope. #}

{#op||inspect||(\*)||(S+)||
Returns a list of symbols published on {{q}}'s scope. #}

{#op||load||S||\*?||
Parses and interprets the specified {{M}} file {{s}}, adding [.min](class:ext) if not specified. #}

{#op||module||(\*) §||{{null}}||
Creates a new module {{sl}} based on quotation {{q}}. #}

{#op||publish||§ (*)||{{null}}||
Publishes symbol {{sl}} to the scope of [(\*)](class:kwd).

> %sidebar%
> Example
>
> Publish symbol [my-local-symbol](class:kwd) to [ROOT](class:kwd) scope:
> `'my-local-symbol ROOT publish`

#}

{#op||raise||(E)||{{null}}||
Raises the error specified via the dictionary {{e}}.#}


{#op||sigils||{{null}}||(S+)||
Returns a list of all sigils defined in the [ROOT](class:kwd) scope.#}

{#op||source||§||(\*)||
Display the source code of symbol {{sl}} (if it has been implemented a {{M}} quotation). #}

{#op||symbols||{{null}}||(S+)||
Returns a list of all symbols defined in the [ROOT](class:kwd) scope.#}

{#op||to-json||(\*)||S||
Converts a quotation into a JSON string {{s}}.#}

{#op||with||(2) (1)||\*?||
Applies quotation [(2)](class:kwd) within the scope of [(1)](class:kwd). #}

### `io` Module

### `fs` Module

### `sys` Module

### `str` Module

### `logic` Module

### `num` Module

### `time` Module

### `crypto` Module