all repos — min @ 0cac73c1ab2f5e2fdcb0edd5512d1d7f7de06d8e

A small but practical concatenative programming language.

Removed all references to ROOT/lang module (substituted with "global").
h3rald h3rald@h3rald.com
Mon, 29 Jan 2024 11:26:54 +0100
commit

0cac73c1ab2f5e2fdcb0edd5512d1d7f7de06d8e

parent

63d8276b1479ce9ee680674f716c08d4fc49e13e

M Min_DeveloperGuide.mdMin_DeveloperGuide.md

@@ -93,9 +93,9 @@

{@ site/contents/reference.md || 1 @} -### `lang` Module +### `global` Module -{@ site/contents/reference-lang.md || 1 @} +{@ site/contents/reference-global.md || 1 @} ### `stack` Module
M help.jsonhelp.json

@@ -164,12 +164,6 @@ "description": "See bind",

"kind": "symbol", "name": "@" }, - "ROOT": { - "description": "Returns a module holding a reference to the [ROOT](class:kwd) scope.\r\n\r\n \r\n Tip\r\n \r\n This symbol is very useful in conjunction with the **with** operator.", - "kind": "symbol", - "name": "ROOT", - "signature": " ==> dict" - }, "^": { "description": "See lambda", "kind": "symbol",

@@ -1446,7 +1440,7 @@ "name": "over",

"signature": "a1 a2 ==> a1 a2 a1" }, "parent-scope": { - "description": "Returns a dictionary dict2 holding a reference to the parent scope of dict1 or null if dict1 is ROOT.", + "description": "Returns a dictionary dict2 holding a reference to the parent scope of dict1 or null if dict1 is global.", "kind": "symbol", "name": "parent-scope", "signature": "dict1 ==> dict2"

@@ -1542,7 +1536,7 @@ "name": "prompt",

"signature": " ==> str" }, "publish": { - "description": "Publishes symbol 'sym to the scope of dict.\r\n \r\n \r\n Example\r\n \r\n Publish symbol [my-local-symbol](class:kwd) to [ROOT](class:kwd) scope:\r\n 'my-local-symbol ROOT publish", + "description": "Publishes symbol 'sym to the scope of dict.\r\n \r\n \r\n Example\r\n \r\n Publish symbol [my-local-symbol](class:kwd) to [global](class:kwd) scope:\r\n 'my-local-symbol global publish", "kind": "symbol", "name": "publish", "signature": "'sym dict ==> "

@@ -1948,7 +1942,7 @@ "name": "shr",

"signature": "int1 int2 ==> int3" }, "sigils": { - "description": "Returns a list of all sigils defined in the [ROOT](class:kwd) scope.", + "description": "Returns a list of all sigils defined in the [global](class:kwd) scope.", "kind": "symbol", "name": "sigils", "signature": " ==> (str*)"

@@ -2098,7 +2092,7 @@ "name": "swons",

"signature": "(a*) a1 ==> (a1 a*)" }, "symbols": { - "description": "Returns a list of all symbols defined in the [ROOT](class:kwd) scope.", + "description": "Returns a list of all symbols defined in the [global](class:kwd) scope.", "kind": "symbol", "name": "symbols", "signature": " ==> (str*)"

@@ -2254,7 +2248,7 @@ "name": "try",

"signature": "(quot1 quot2? quot3?) ==> a*" }, "type": { - "description": "Returns the type of a.", + "description": "Puts the data type of a on the stack. In cased of typed dictionaries, the type name is prefixed by dict:, e.g. dict:module, dict:socket, etc.", "kind": "symbol", "name": "type", "signature": "a ==> str"
M min.vimmin.vim

@@ -1,8 +1,8 @@

" Vim syntax file " Language: min " Maintainer: Fabio Cevasco -" Last Change: 08 Oct 2023 -" Version: 0.40.0 +" Last Change: 29 Jan 2024 +" Version: 0.43.0 if exists("b:current_syntax") finish

@@ -11,7 +11,7 @@

setl iskeyword=@,36-39,+,-,*,.,/,:,~,!,48-57,60-65,94-95,192-255 setl iskeyword+=^ -syntax keyword minDefaultSymbol ! != $ % & && ' * + - -> -inf . .. / : :: < <= =% =-= == ==> => > >< >= >> ? @ ROOT ^ abs absolute-path absolute-path? accept acos admin? aes all? and any? append apply apply-interpolate args asin ask atan atime avg bind bitand bitnot bitor bitxor boolean boolean? capitalize case cd ceil chmod choose chr clear clear-stack cleave close column-print compiled? concat confirm connect cons cos cosh cp cpu crypto ctime d2r datetime ddel ddup debug decode decode-url define defined-sigil? defined-symbol? delete-sigil delete-symbol dequote dev? dget dget-raw dhas? dict dictionary? difference dip dir? dirname div dkeys download dpairs dpick drop dsdelete dset dset-sym dsget dshas? dsinit dspost dsput dsquery dsread dstore dswrite dtype dup dvalues e encode encode-url env? error escape eval even? exists? exit expand-filename expand-symlink expect expect-all expect-any expect-empty-stack fappend fatal file? filename filter find first flatten float float? floor foreach format-error fperms fread from-json from-semver from-xml from-yaml fs fsize fstats ftype fwrite get get-content get-env get-raw get-stack getchr gets getstack hardlink harvest help hidden? http id if import in? indent indexof inf infix-dequote info insert integer integer? interpolate intersection invoke io join join-path keep lambda lambda-bind lambdabind last length line-info linrec listen ln load load-symbol log10 log2 logic loglevel loglevel? lowercase ls ls-r map map-reduce mapkey match? math md4 md5 med mkdir mod mtime mv nan net newline nip normalized-path not notice now null? num number? odd? one? operator opts or ord os over parent-scope parse parse-url partition password pi pick pop pow pred prefix prefix-dequote prepend print product prompt publish put-env putchr puts quit quotation? quote quote-map quotecmd quoted-symbol? quotesym r2g raise random randomize range raw-args read recv recv-line reduce reject relative-path remove remove-symbol repeat replace replace-apply request require rest return reverse rm rmdir rolldown rollup round run save-symbol saved-symbols scope scope-sigils scope-symbols seal-sigil seal-symbol sealed-sigil? sealed-symbol? search search-all semver-inc-major semver-inc-minor semver-inc-patch semver? send seq set set-stack set-sym setstack sha1 sha224 sha256 sha384 sha512 shl shorten shr sigil-help sigils sin sinh sip size sleep slice socket sort source split spread sqrt stack start-server stop-server str string string? stringlike? strip substr succ suffix sum swap swons symbol-help symbols symlink symlink? symmetric-difference sys system take tan tanh tap tau tformat time timeinfo times timestamp titleize to-json to-semver to-timestamp to-xml to-yaml trunc try type type? typealias typealias:xml-node union unix-path unless unmapkey unseal-sigil unseal-symbol unzip uppercase version warn when which while windows-path with write xcdata xcomment xelement xentity xml xor xquery xqueryall xtext zip ~ +syntax keyword minDefaultSymbol ! != $ % & && ' * + - -> -inf . .. / : :: < <= =% =-= == ==> => > >< >= >> ? @ ^ abs absolute-path absolute-path? accept acos admin? aes all? and any? append apply apply-interpolate args asin ask atan atime avg base base? bind bitand bitclear bitflip bitnot bitor bitparity bitset bitxor boolean boolean? capitalize case cd ceil chmod choose chr clear clear-stack cleave close column-print compiled? concat confirm connect cons cos cosh cp cpu crypto ctime d2r datetime ddel ddup debug decode decode-url define defined-sigil? defined-symbol? delete-sigil delete-symbol dequote dev dev? dget dget-raw dhas? dict dictionary? difference dip dir? dirname div dkeys download dpairs dpick drop dsdelete dset dset-sym dsget dshas? dsinit dspost dsput dsquery dsread dstore dswrite dtype dup dvalues e encode encode-url env? error escape eval even? exists? exit expand-filename expand-symlink expect expect-all expect-any expect-empty-stack fappend fatal file? filename filter find first flatten float float? floor foreach format-error fperms fread from-bin from-dec from-hex from-json from-oct from-semver from-xml from-yaml fs fsize fstats ftype fwrite get get-content get-env get-raw get-stack getchr gets getstack global hardlink harvest help hidden? http id if import in? indent indexof inf infix-dequote info insert integer integer? interpolate intersection invoke io join join-path keep lambda lambda-bind lambdabind last length line-info linrec listen ln load load-symbol log10 log2 logic loglevel loglevel? lowercase ls ls-r map map-reduce mapkey match? math md4 md5 med mkdir mod mtime mv nan net newline nip normalized-path not notice now null? num number? odd? one? operator opts or ord os over parent-scope parse parse-url partition password pi pick pop pow pred prefix prefix-dequote prepend print product prompt publish put-env putchr puts quit quotation? quote quote-map quotecmd quoted-symbol? quotesym r2g raise random randomize range raw-args read recv recv-line reduce reject relative-path remove remove-symbol repeat replace replace-apply request require rest return reverse rm rmdir rolldown rollup round run save-symbol saved-symbols scope scope-sigils scope-symbols seal-sigil seal-symbol sealed-sigil? sealed-symbol? search search-all semver-inc-major semver-inc-minor semver-inc-patch semver? send seq set set-stack set-sym setstack sha1 sha224 sha256 sha384 sha512 shl shorten shr sigil-help sigils sin sinh sip size sleep slice socket sort source split spread sqrt stack start-server stop-server str string string? stringlike? strip substr succ suffix sum swap swons symbol-help symbols symlink symlink? symmetric-difference sys system take tan tanh tap tau tformat time timeinfo times timestamp titleize to-bin to-dec to-hex to-json to-oct to-semver to-timestamp to-xml to-yaml tokenize trunc try type type? typealias typealias:xml-node union unix-path unless unmapkey unseal-sigil unseal-symbol unzip uppercase version warn when which while windows-path with write xcdata xcomment xelement xentity xml xor xquery xqueryall xtext zip ~ syntax match minDefaultSymbol ;||; syntax keyword minCommentTodo TODO FIXME XXX TBD contained
M site/contents/get-started.mdsite/contents/get-started.md

@@ -157,7 +157,7 @@ > %min-terminal%

> > [$](class:prompt) min compile myfile.min -n:&quot;-d:release --threadAnalysis:off --mm:refc&quot; -Additionally, you can also use `-m:<path>` (or `--module-path`) to specify one path containing [.min](class:ext) files which will be compiled as well (but not executed) along with the specified file. Whenever a {#link-operator||lang||load#} or a {#link-operator||lang||require#} symbol is used to load/require an external [.min](class:ext) file, it will attempt to retrieve its contents from the pre-loaded files first before searching the filesystem. +Additionally, you can also use `-m:<path>` (or `--module-path`) to specify one path containing [.min](class:ext) files which will be compiled as well (but not executed) along with the specified file. Whenever a {#link-operator||global||load#} or a {#link-operator||global||require#} symbol is used to load/require an external [.min](class:ext) file, it will attempt to retrieve its contents from the pre-loaded files first before searching the filesystem. For example, the following command executed in the root folder of the min project will compile [run.min](class:file) along with all [.min](class:ext) files included in the [tasks](class:dir) folder and its subfolders:

@@ -174,7 +174,7 @@ > In order to successfully compile [.min](class.ext) files, Nim must be installed on your system and min must be installed via nimble.

## Getting help on a min symbol -min comes with a built-in `help` command that can be used to print information on a specific symbol. Essentially, this is equivalent to use the {#link-operator||lang||help#} symbol within the min REPL. +min comes with a built-in `help` command that can be used to print information on a specific symbol. Essentially, this is equivalent to use the {#link-operator||global||help#} symbol within the min REPL. > %min-terminal% >
M site/contents/learn-control-flow.mdsite/contents/learn-control-flow.md

@@ -5,17 +5,17 @@ -----

{@ _defs_.md || 0 @} -The {#link-module||lang#} provide some symbols that can be used for the most common control flow statements. Unlike most programming languages, min does not differentiate between functions and statements -- control flow statements are just ordinary symbols that manipulate the main stack. +The {#link-module||global#} provide some symbols that can be used for the most common control flow statements. Unlike most programming languages, min does not differentiate between functions and statements -- control flow statements are just ordinary symbols that manipulate the main stack. ## Conditionals The following symbols provide ways to implement common conditional statements: -* {#link-operator||lang||case#} -* {#link-operator||lang||if#} -* {#link-operator||lang||unless#} -* {#link-operator||lang||when#} +* {#link-operator||global||case#} +* {#link-operator||global||if#} +* {#link-operator||global||unless#} +* {#link-operator||global||when#} For example, consider the following program:

@@ -38,9 +38,9 @@ ## Loops

The following symbols provide ways to implement common loops: -* {#link-operator||lang||foreach#} -* {#link-operator||lang||times#} -* {#link-operator||lang||while#} +* {#link-operator||global||foreach#} +* {#link-operator||global||times#} +* {#link-operator||global||while#} For example, consider the following program:

@@ -57,15 +57,15 @@ ) while

f ) ^factorial -This program defines a symbol `factorial` that calculates the factorial of an integer iteratively using the symbol {#link-operator||lang||while#}. +This program defines a symbol `factorial` that calculates the factorial of an integer iteratively using the symbol {#link-operator||global||while#}. ## Error handling The following symbols provide ways to manage errors in min: -* {#link-operator||lang||format-error#} -* {#link-operator||lang||raise#} -* {#link-operator||lang||try#} +* {#link-operator||global||format-error#} +* {#link-operator||global||raise#} +* {#link-operator||global||try#} For example, consider the following program:
M site/contents/learn-data-types.mdsite/contents/learn-data-types.md

@@ -54,7 +54,7 @@ > The {#link-operator||dict||dtype#} operator can be used to set the type of a dictionary.

The {#link-module||logic#} provides predicate operators to check if an element belongs to a particular data type or pseudo-type (`boolean?`, `number?`, `integer?`, `float?`, ...). -Additionally, the {#link-module||lang#} provides operators to convert values from a data type to another (e.g. {#link-operator||lang||integer#}, {#link-operator||lang||string#}, and so on). +Additionally, the {#link-module||global#} provides operators to convert values from a data type to another (e.g. {#link-operator||global||integer#}, {#link-operator||global||string#}, and so on). > %note% > Note
M site/contents/learn-definitions.mdsite/contents/learn-definitions.md

@@ -14,7 +14,7 @@ swap mtime now 3600 - >

This program takes a single string corresponding to a file path and returns true if it's a .zip file bigger than 1MB that was modified in the last hour. Sure, it is remarkable that no variables are needed for such a program, but it is not very readable: because no variables are used, it is often necessary to make copies of elements and push them to the end of the stack -- that's what the {#link-operator||stack||dup#} and {#link-operator||stack||swap#} are used for. -The good news is that you can use the {#link-operator||lang||define#} operator and the `:` sigil to define new symbols, and symbols can also be set to fixed values (literals). +The good news is that you can use the {#link-operator||global||define#} operator and the `:` sigil to define new symbols, and symbols can also be set to fixed values (literals). Consider the following program:

@@ -47,7 +47,7 @@ ...What is the value of the symbol `a` after executing it?

Simple: `4`. Every quotation defines its own scope, and in each scope, a new variable called `a` is defined. In the innermost scope containing the quotation `(a dup * :a)` the value of `a` is set to `64`, but this value is not propagated to the outer scopes. Note also that the value of `a` in the innermost scope is first retrieved from the outer scope (8). -If we want to change the value of the original `a` symbol defined in the outermost scope, we have to use the {#link-operator||lang||bind#} or its shorthand sigil `@`, so that the program becomes the following: +If we want to change the value of the original `a` symbol defined in the outermost scope, we have to use the {#link-operator||global||bind#} or its shorthand sigil `@`, so that the program becomes the following: 4 :a ;First definition of the symbol a (

@@ -70,12 +70,12 @@ (5 :quote quote dup *) -> ;returns 25

...because the `quote` symbol is only defined in the root scope and can therefore be redefined in child scopes. -If you want, you can {#link-operator||lang||seal#} your own symbols so that they may not be redefined using the {#link-operator||lang||bind#} operator or deleted using the {#link-operator||lang||delete#}. +If you want, you can {#link-operator||global||seal#} your own symbols so that they may not be redefined using the {#link-operator||global||bind#} operator or deleted using the {#link-operator||global||delete#}. > %note% > Note > -> The {#link-operator||lang||unseal-symbol#} operator can be used to effectively un-seal a previously-sealed symbol. Use with caution! +> The {#link-operator||global||unseal-symbol#} operator can be used to effectively un-seal a previously-sealed symbol. Use with caution! {#link-learn||scopes||Scopes#}
M site/contents/learn-extending.mdsite/contents/learn-extending.md

@@ -16,7 +16,7 @@ ## Implementing new min modules using min itself

When you just want to create more high-level min operator using functionalities that are already available in min, the easiest way is to create your own reusable min modules. -To create a new module, simply create a file containing your operator definitions implemented using either the {#link-operator||lang||operator#} operator or the {#link-operator||lang||lambda#} operator +To create a new module, simply create a file containing your operator definitions implemented using either the {#link-operator||global||operator#} operator or the {#link-operator||global||lambda#} operator ``` (dup *) ^pow2

@@ -25,7 +25,7 @@ (dup * dup *) ^pow4

``` -Save your code to a file (e.g. *quickpows.min*) and you can use it in other Nim files using the {#link-operator||lang||require#} operator and the {#link-operator||lang||import#} (if you want to import the operators in the current scope): +Save your code to a file (e.g. *quickpows.min*) and you can use it in other Nim files using the {#link-operator||global||require#} operator and the {#link-operator||global||import#} (if you want to import the operators in the current scope): ``` 'quickpows require :qp

@@ -57,7 +57,7 @@ ; Unseal prompt symbol

'prompt unseal-symbol ``` -Essentially, this causes min to import *all* the modules and unseals the {#link-operator||lang||prompt#} symbol so that it can be customized. If you want, you can provide your own prelude file to specify your custom behaviors, selectively import modules, and define your own symbols, like this: +Essentially, this causes min to import *all* the modules and unseals the {#link-operator||global||prompt#} symbol so that it can be customized. If you want, you can provide your own prelude file to specify your custom behaviors, selectively import modules, and define your own symbols, like this: > %min-terminal% > [$](class:prompt) min -i -p:myfile.min
M site/contents/learn-mmm.mdsite/contents/learn-mmm.md

@@ -28,7 +28,7 @@ The registry contains the metadata of all public managed modules and it is queried when running every mmm command (see below).

### Module lookup -When requiring a module in your min file using the {{#link-operator||lang||require}} symbol, min will attempt to lookup the module (for example **module1**) checking the following files (in order): +When requiring a module in your min file using the {{#link-operator||global||require}} symbol, min will attempt to lookup the module (for example **module1**) checking the following files (in order): - module1.min - mmm/module1/*/index.min
M site/contents/learn-operators.mdsite/contents/learn-operators.md

@@ -19,7 +19,7 @@

* Start with a letter or an underscore (\_). * Contain zero or more letters, numbers and/or any of the following characters: `/ ! ? + * . _ -` -It is possible to define operator symbols using the {#link-operator||lang||operator#} symbol. The following min program defines a new symbol called square that duplicates the first element on the stack and multiplies the two elements: +It is possible to define operator symbols using the {#link-operator||global||operator#} symbol. The following min program defines a new symbol called square that duplicates the first element on the stack and multiplies the two elements: ( symbol square

@@ -28,23 +28,23 @@ (n dup * @result)

) operator ;; Calculates the square of n. - The {#link-operator||lang||operator#} symbol provides way to: + The {#link-operator||global||operator#} symbol provides way to: * Specify the name of the symbol operator (**square** in this case) * Specify a signature to identify the type of the input and output values (in this case, the operator takes a numeric input value and produces a numeric output value). Also, note how inputs and outputs are captured into the `n` and `result` symbols in the signature quotation and then referenced in the body quotation. * Specify a quotation containing the code that the operator will execute. -Also, symbol operator definitions can be annotated with documentation comments (starting with `;;` or wrapped in `#|| ... ||#`)) so that a help text can be displayed using the {#link-operator||lang||help#} symbol. +Also, symbol operator definitions can be annotated with documentation comments (starting with `;;` or wrapped in `#|| ... ||#`)) so that a help text can be displayed using the {#link-operator||global||help#} symbol. ### Using the lambda operator -Sometimes you just want to bind a piece of code to a symbol to reuse it later, typically something simple and easy-to-read. In these cases, you can use the {#link-operator||lang||lambda#} operator (or the `^` sigil). For example, the previous `square` operator definition could be rewritten simply as the following. +Sometimes you just want to bind a piece of code to a symbol to reuse it later, typically something simple and easy-to-read. In these cases, you can use the {#link-operator||global||lambda#} operator (or the `^` sigil). For example, the previous `square` operator definition could be rewritten simply as the following. (dup *) ^square -Note that this feels like using {#link-operator||lang||define#}, but the main difference between {#link-operator||lang||lambda#} and {#link-operator||lang||define#} is that `lambda` only works on quotations doesn't auto-quote them, so that they are immediately evaluated when the corresponding symbol is pushed on the stack. +Note that this feels like using {#link-operator||global||define#}, but the main difference between {#link-operator||global||lambda#} and {#link-operator||global||define#} is that `lambda` only works on quotations doesn't auto-quote them, so that they are immediately evaluated when the corresponding symbol is pushed on the stack. -Also note that unlike with {#link-operator||lang||operator#}, symbols defined with {#link-operator||lang||lambda#}: +Also note that unlike with {#link-operator||global||operator#}, symbols defined with {#link-operator||global||lambda#}: * have no built-in validation of input and output values. * do not support the `return` symbol to immediately end their execution.

@@ -53,7 +53,7 @@

> %tip% > Tip > -> You can use {#link-operator||lang||lambda-bind#} to re-set a previously set lambda. +> You can use {#link-operator||global||lambda-bind#} to re-set a previously set lambda. ## Sigils

@@ -68,25 +68,25 @@

Currently min provides the following sigils: ' -: Alias for {#link-operator||lang||quote#}. +: Alias for {#link-operator||global||quote#}. \: -: Alias for {#link-operator||lang||define#}. +: Alias for {#link-operator||global||define#}. * -: Alias for {#link-operator||lang||invoke#}. +: Alias for {#link-operator||global||invoke#}. @ -: Alias for {#link-operator||lang||bind#}. +: Alias for {#link-operator||global||bind#}. ^ -: Alias for {#link-operator||lang||lambda#}. +: Alias for {#link-operator||global||lambda#}. > -: Alias for {#link-operator||lang||save-symbol#}. +: Alias for {#link-operator||global||save-symbol#}. < -: Alias for {#link-operator||lang||load-symbol#}. +: Alias for {#link-operator||global||load-symbol#}. / : Alias for {#link-operator||dict||dget#}. % : Alias for {#link-operator||dict||dset#}. ? -: Alias for {#link-operator||lang||help#}. +: Alias for {#link-operator||global||help#}. ! : Alias for {#link-operator||sys||system#}. &

@@ -102,7 +102,7 @@ * can be unsealed, deleted, redefined, and sealed.

Sigils can be a very powerful construct and a way to reduce boilerplate code: you can define a sigil to use as you would use any symbol which requires a single string or quoted symbol on the stack. -Like symbols, sigils can be defined with the {#link-operator||lang||operator#} operator, like this: +Like symbols, sigils can be defined with the {#link-operator||global||operator#} operator, like this: ( sigil j

@@ -118,18 +118,18 @@ ...will push the following dictionary on the stack:

{true :test} -Also, sigil definitions can be annotated with documentation comments (starting with `;;` or wrapped in `#|| ... ||#`) so that a help text can be displayed using the {#link-operator||lang||help#} symbol. +Also, sigil definitions can be annotated with documentation comments (starting with `;;` or wrapped in `#|| ... ||#`) so that a help text can be displayed using the {#link-operator||global||help#} symbol. ## Auto-popping -Typically, but not always, operators push one or more value to the stack. While this is typically the desired behavior, in some cases you may want to keep the stack clear so in these cases you can append a `!` character to any symbol to cause the symbol {#link-operator||lang||pop#} to be pushed on the stack immediately afterwards. +Typically, but not always, operators push one or more value to the stack. While this is typically the desired behavior, in some cases you may want to keep the stack clear so in these cases you can append a `!` character to any symbol to cause the symbol {#link-operator||global||pop#} to be pushed on the stack immediately afterwards. "test" puts ;Prints "test" and pushes "test" on the stack. "test" puts! ;Prints "test" without pushing anything on the stack. ## Operator signatures -When defining symbols and sigils with the {#link-operator||lang||operator#} operator, you must specify a *signature* that will be used to validate and capture input and output values: +When defining symbols and sigils with the {#link-operator||global||operator#} operator, you must specify a *signature* that will be used to validate and capture input and output values: ( symbol square

@@ -149,7 +149,7 @@

> %note% > Note > -> If the operator you are defining doesn't require any input value or doesn't leave ang output value on the stack, simply don't put anything before or after the `==>` separator, respectively. For example, the signature of the {#link-operator||lang||puts!#} operator could be written like `(a ==>)`. +> If the operator you are defining doesn't require any input value or doesn't leave ang output value on the stack, simply don't put anything before or after the `==>` separator, respectively. For example, the signature of the {#link-operator||global||puts!#} operator could be written like `(a ==>)`. ### Type classes

@@ -163,7 +163,7 @@ (quot :q ==> bool :o)

(q (string?) all? @o) ) :: -The {#link-operator||lang||operator#} operator can be used to define a symbol prefixed with `typeclass:` (`typeclass:strquot` in this case) corresponding to a type class that can be used in operator signatures in place of a type, like this: +The {#link-operator||global||operator#} operator can be used to define a symbol prefixed with `typeclass:` (`typeclass:strquot` in this case) corresponding to a type class that can be used in operator signatures in place of a type, like this: ( symbol join-strings

@@ -196,13 +196,13 @@ Essentially, this allows you to push a lambda on the stack from an operator.

Note that: -* Lambdas must be captured using the `^` sigil in signatures and bound using {#link-operator||lang||lambda-bind#} in the operator body. +* Lambdas must be captured using the `^` sigil in signatures and bound using {#link-operator||global||lambda-bind#} in the operator body. * Lambdas cannot be captured in input values (they have already been pushed on the stack). * Requiring a lambda as an output value effectively bypasses stack pollution checks. While this can be useful at times, use with caution! ### Type expressions -When specifying types in operator signatures or through the {#link-operator||lang||expect#} operator, you can specify a logical expression containing types and type classes joined with one of the following operators: +When specifying types in operator signatures or through the {#link-operator||global||expect#} operator, you can specify a logical expression containing types and type classes joined with one of the following operators: * `|` (or) * `&` (and)

@@ -249,7 +249,7 @@ ```

### Type aliases -As you can see, type expressions can quickly become quite long and complex. To avoid this, you can define *type aliases* using the {#link-operator||lang||typealias#} operator. +As you can see, type expressions can quickly become quite long and complex. To avoid this, you can define *type aliases* using the {#link-operator||global||typealias#} operator. For example, you can create an alias of part of the type expression used in the previous example, like this:

@@ -268,7 +268,7 @@ Note that:

* Type aliases be used to create an alias for any type expression. * Aliased type expressions can contain standard {{m}} types, dictionary types, type classes, and even other type aliases. -* The {#link-operator||lang||typealias#} operator actually creates lexically-scoped, `typealias:`-prefixed symbols that can be sealed, unsealed, and deleted exactly like other symbols. +* The {#link-operator||global||typealias#} operator actually creates lexically-scoped, `typealias:`-prefixed symbols that can be sealed, unsealed, and deleted exactly like other symbols. ### Generics

@@ -312,7 +312,7 @@ > By contrast, using the same type union several times within the same signature allows different types to be used in the same call, and that is probably something you don't want!

### Constructors -The {#link-operator||lang||operator#} operator can also be used to create *constructor* symbols. A constructor is a particular type of operator that is used to create a new typed dictionary. +The {#link-operator||global||operator#} operator can also be used to create *constructor* symbols. A constructor is a particular type of operator that is used to create a new typed dictionary. Consider the following example:
M site/contents/learn-quotations.mdsite/contents/learn-quotations.md

@@ -42,13 +42,13 @@ This program returns a new quotation containing all odd numbers contained in quotation `(1 2 3 4 5 6 7)`.

In this case, the second quotation is used to _quote_ the symbol `odd?` so that instead of being executed immediately, it will be executed by the symbol `filter` on each element of the first quotation. In this way, we may say that `(odd?)` is _dequoted_ by the symbol `filter`. -The symbol {#link-operator||lang||dequote#} or its alias `->` can be used to dequote a quotation by pushing all its elements on the main stack. Essentially, this *executes* the quotation in the current context. +The symbol {#link-operator||global||dequote#} or its alias `->` can be used to dequote a quotation by pushing all its elements on the main stack. Essentially, this *executes* the quotation in the current context. For example, the following program leaves the elements `1` and `-1` on the stack: (1 2 3 -) -> -Alternatively, the symbol {#link-operator||lang||apply#} or its alias `=>` can also be used to dequote a quotation but in this case it will not push its elements on the main stack, instead it will: +Alternatively, the symbol {#link-operator||global||apply#} or its alias `=>` can also be used to dequote a quotation but in this case it will not push its elements on the main stack, instead it will: 1. Create a temporary empty stack. 2. Push all elements on it, one by one.
M site/contents/learn-scopes.mdsite/contents/learn-scopes.md

@@ -10,10 +10,10 @@ * is created while a new quotation is being dequoted or a dictionary is created.

* is destroyed after a quotation has been dequoted. * is attached to a dictionary. -The main, root-level scope in min can be accessed using the {#link-operator||lang||ROOT#} symbol and it typically contains all symbols and sigils imported from all the standard library modules. The ROOT symbol pushes a module on the stack that references the ROOT scope: +The main, root-level scope in min can be accessed using the {#link-module||global#} symbol and it typically contains all symbols and sigils imported from all the standard library modules. The global symbol pushes a module on the stack that references the global scope: > %min-terminal% -> [[/Users/h3rald/test]$](class:prompt) ROOT +> [[/Users/h3rald/test]$](class:prompt) global > { > &lt;native&gt; :! > &lt;native&gt; :!=

@@ -30,7 +30,7 @@ > &lt;native&gt; values cannot be retrieved using the {#link-operator||dict||dget#} operator.

## Accessing the current scope -You can access the current scope using the {#link-operator||lang||scope#} operator, which pushes a module on the stack that references the current scope. +You can access the current scope using the {#link-operator||global||scope#} operator, which pushes a module on the stack that references the current scope. Consider the following program:

@@ -38,15 +38,15 @@ {} :innerscope ("This is a test" :test scope @myscope) -> myscope scope-symbols

In this case: -1. A new variable called `innerscope` is defined on the ROOT scope. +1. A new variable called `innerscope` is defined on the global scope. 2. A quotation is dequoted, but its scope is retrieved using the `scope` operator and bound to `innerscope`. -3. After the quotation is dequoted, myscope is accessed and its symbols (`test` in this case) are pushed on the stack using the {#link-operator||lang||scope-symbols#} operator. +3. After the quotation is dequoted, myscope is accessed and its symbols (`test` in this case) are pushed on the stack using the {#link-operator||global||scope-symbols#} operator. -Note that scopes can only be accessed if they are bound to a dictionary, hence the `ROOT` and `scope` operators push a module on the stack, and a module is nothing but a typed dictionary. +Note that scopes can only be accessed if they are bound to a dictionary, hence the `global` and `scope` operators push a module on the stack, and a module is nothing but a typed dictionary. ## Dequoting a quotation within the context of a specific scope -The {#link-operator||lang||with#} operator can be used to dequote a quotation within a specific scope instead of the current one. +The {#link-operator||global||with#} operator can be used to dequote a quotation within a specific scope instead of the current one. Consider the following program, which leaves `2` on the stack:

@@ -56,6 +56,6 @@ In this case, when `with` is pushed on the stack, it will dequote `(4 2 minus)`. Note that the symbol `minus` is defined in the dictionary that will be used by `with` as the current scope, so after `with` is pushed on the stack, the stack contents are:

4 2 (-) -At this point, the {#link-operator||lang||dequote#} operator is pushed on the stack and the subtraction is executed leaving `2` on the stack. +At this point, the {#link-operator||global||dequote#} operator is pushed on the stack and the subtraction is executed leaving `2` on the stack. {#link-learn||control-flow||Control Flow#}
M site/contents/learn-shell.mdsite/contents/learn-shell.md

@@ -64,6 +64,6 @@ This file is used to persist all commands entered in the min shell, and it is loaded in memory at startup to provide line history support.

### .min\_symbols -This files contains all symbol definitions in JSON format that were previously-saved using the {#link-operator||lang||save-symbol#} symbol. Symbols can be loaded using the {#link-operator||lang||load-symbol#} symbol. +This files contains all symbol definitions in JSON format that were previously-saved using the {#link-operator||global||save-symbol#} symbol. Symbols can be loaded using the {#link-operator||global||load-symbol#} symbol. {#link-learn||extending||Extending min#}
M site/contents/reference-lang.mdsite/contents/reference-global.md

@@ -1,6 +1,6 @@

----- content-type: "page" -title: "lang Module" +title: "global Module" ----- {@ _defs_.md || 0 @}

@@ -335,7 +335,7 @@ {#op||opts||{{none}}||{{d}}||

Returns a dictionary of all options passed to the current program, with their respective values.#} {#op||parent-scope||{{d1}}||{{d2}}|| -Returns a dictionary {{d2}} holding a reference to the parent scope of {{d1}} or {{null}} if {{d1}} is ROOT.#} +Returns a dictionary {{d2}} holding a reference to the parent scope of {{d1}} or {{null}} if {{d1}} is global.#} {#op||parse||{{s}}||{{q}}|| Parses {{s}} and returns a quoted program {{q}}. #}

@@ -364,8 +364,8 @@ >

> > %sidebar% > > Example > > -> Publish symbol [my-local-symbol](class:kwd) to [ROOT](class:kwd) scope: -> > `'my-local-symbol ROOT publish` #} +> Publish symbol [my-local-symbol](class:kwd) to [global](class:kwd) scope: +> > `'my-local-symbol global publish` #} {#op||puts||{{any}}||{{any}}|| Prints {{any}} and a new line to STDOUT.#}

@@ -408,15 +408,6 @@ If used within the body quotation of an operator definition, causes the interpreter to stop pushing further body elements on the stack and start pushing tbe operator output values on the stack.

If used outside of the body quotation of an operator definition, it raises an exception.#} -{#op||ROOT||{{none}}||{{d}}|| -Returns a module holding a reference to the [ROOT](class:kwd) scope. - -> > %tip% -> > Tip -> > -> > This symbol is very useful in conjunction with the **with** operator. - #} - {#op||save-symbol||{{sl}}||{{none}}|| Saves the contents of symbol {{sl}} to the [.min\_symbols](class:file) file. #}

@@ -458,7 +449,7 @@ {#op||sigil-help||{{sl}}||{{help}}|{{null}}||

Returns the help dictionary for the sigil {{sl}}, if available, {{null}} otherwise. #} {#op||sigils||{{none}}||({{s0p}})|| -Returns a list of all sigils defined in the [ROOT](class:kwd) scope.#} +Returns a list of all sigils defined in the [global](class:kwd) scope.#} {#op||source||{{sl}}||{{q}}|| Display the source code of symbol {{sl}} (if it has been implemented a {{m}} quotation). #}

@@ -467,7 +458,7 @@ {#op||string||{{any}}||{{s}}||

Converts {{any}} to its string representation.#} {#op||symbols||{{none}}||({{s0p}})|| -Returns a list of all symbols defined in the [ROOT](class:kwd) scope.#} +Returns a list of all symbols defined in the [global](class:kwd) scope.#} {#op||symbol-help||{{sl}}||{{help}}|{{null}}|| Returns the help dictionary for the symbol {{sl}}, if available, {{null}} otherwise. #}
M site/contents/reference.mdsite/contents/reference.md

@@ -6,7 +6,7 @@ {@ _defs_.md || 0 @}

min includes a small but powerful standard library organized into the following _modules_: -{#link-module||lang#} +{#link-module||global#} : Defines the basic language constructs, such as control flow, type conversions, symbol definition and binding, exception handling, etc. {#link-module||stack#} : Defines combinators and stack-shufflers like dip, dup, swap, cons, etc.