all repos — min @ f27058c9068a661406f6a444a0c1ad27475e57dc

A small but practical concatenative programming language.

Fixed docs (#41, #42)
h3rald h3rald@h3rald.com
Fri, 10 Jan 2020 16:37:21 +0100
commit

f27058c9068a661406f6a444a0c1ad27475e57dc

parent

ecd4ef1c31b2bec6e6f85e39cb1344eb9fb87c2d

M Min_DeveloperGuide.mdMin_DeveloperGuide.md

@@ -97,6 +97,10 @@ ### `seq` Module

{@ site/contents/reference-seq.md || 1 @} +### `dict` Module + +{@ site/contents/reference-dict.md || 1 @} + ### `io` Module {@ site/contents/reference-io.md || 1 @}
M core/consts.nimcore/consts.nim

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

const pkgName* = "min" - pkgVersion* = "0.19.5" + pkgVersion* = "0.19.6" pkgAuthor* = "Fabio Cevasco" pkgDescription* = "A tiny concatenative programming language and shell."
M site/contents/download.mdsite/contents/download.md

@@ -64,7 +64,7 @@ > [[/Users/h3rald/test]$](class:prompt) dup *

> {1} -> 16 > [[/Users/h3rald/test]$](class:prompt) -To exit min shell, press [CTRL+C](class:kbd) or type [exit](class:cmd) and press [ENTER](class:kbd). +To exit min shell, press [CTRL+C](class:kbd) or type [0 exit](class:cmd) and press [ENTER](class:kbd). ## Executing a min Program
M site/contents/learn-data-types.mdsite/contents/learn-data-types.md

@@ -7,6 +7,8 @@

The type system of min is very simple -- only the following data types are available: +boolean +: **true** or **false**. integer : An integer number like 1, 27 or -15. float
M site/contents/learn-definitions.mdsite/contents/learn-definitions.md

@@ -5,7 +5,7 @@ -----

{@ _defs_.md || 0 @} -Being a concatenative language, min does not really need named parameters or variables: simbols just pop elements off the main stack in order, and that's normally enough. There is however one small problem with the traditional concatenative paradigm; consider the following program for example: +Being a concatenative language, min does not really need named parameters or variables: symbols just pop elements off the main stack in order, and that's normally enough. There is however one small problem with the traditional concatenative paradigm; consider the following program for example: dup dup "\.zip$" match

@@ -29,7 +29,7 @@

## Lexical scoping and binding -min, like many other programming languages, uses [lexical scoping](https://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scope_vs._dynamic_scope) to resolve symbols. +min, like many other programming languages, uses [lexical scoping](https://en.wikipedia.org/wiki/Scope_\(computer_science\)#Lexical_scope_vs._dynamic_scope) to resolve symbols. Consider the following program:
M site/contents/learn-operators.mdsite/contents/learn-operators.md

@@ -21,7 +21,7 @@ It is possible to define symbols using the {#link-operator||lang||define#} symbol. The following min program defines a new symbol called square that duplicates the first element on the stack and multiplies the two elements:

(dup *) "square" define -Besides symbols, min provides a set of predefined _sigils_ for commonly-used symbols. For example, the previous definition could be rewritten as follows using sigils: +Besides symbols, min provides a set of predefined _sigils_ as abbreviations for for commonly-used symbols. For example, the previous definition could be rewritten as follows using sigils: (dup *) :square

@@ -48,11 +48,11 @@ : Alias for {#link-operator||lang||quote-bind#}.

\# : Alias for {#link-operator||lang||quote-define#}. / -: Alias for {#link-operator||seq||dget#}. +: Alias for {#link-operator||dict||dget#}. % -: Alias for {#link-operator||seq||dset#}. +: Alias for {#link-operator||dict||dset#}. ? -: Alias for {#link-operator||seq||dhas?#}. +: Alias for {#link-operator||dict||dhas?#}. ! : Alias for {#link-operator||sys||system#}. &
M site/contents/learn-quotations.mdsite/contents/learn-quotations.md

@@ -42,6 +42,19 @@ This programs 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 synbol {#link-operator||lang||dequote#} or its alias `->` can be used to dequote a quotation by pushing all its element on the main stack, while the symbol {#link-operator||lang||apply#} can be used to dequote a quotation by pushing its elements on a separate stack. +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. + +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: +1. Create a temporary empty stack. +2. Push all elements on it, one by one. +3. Push the entire temporary stack as a quotation back on the main stack. + +For example, the following program leaves the element `(1 -1)` on the stack: + + (1 2 3 -) => {#link-learn||definitions||Definitions#}
M site/contents/learn-shell.mdsite/contents/learn-shell.md

@@ -47,7 +47,7 @@

## Shell configuration files -When the min interpreter is first launched, the following files are created automatically in the $HOME directory (%HOMEPROFILE% on Windows). +When the min interpreter is first launched, the following files are created automatically in the $HOME directory (%USERPROFILE% on Windows). ### .minrc
M site/contents/learn.mdsite/contents/learn.md

@@ -20,15 +20,15 @@

Let's see how it works: 1. First a list containing the first five integer is pushed on the stack. -2. Then, another list containing two symbols (`dup` and `*`) is pushed on the stack. This constitutes a quoted program which, when executed duplicates (`dup`) the first element on the stack and then multiplies (`*`) the two elements together. +2. Then, another list containing two symbols (`dup` and `*`) is pushed on the stack. This constitutes a quoted program which, when executed duplicates the first element on the stack —this is done by `dup`— and then multiplies —with `*`— the two elements together. 3. Finally, the symbol `map` is pushed on the stack. Map takes a list of elements and a quoted program and applies the program to each element. Note that: * There are no variable assignments. * elements are pushed on the stack one by one. -* Parentheses are grouped together one or more elements, so that they are treated as a single element and they are not evaluated immediately. -* Symbols can be used to perform operations on the whole stack. +* Parentheses are used to group together one or more elements, so that they are treated as a single element and they are not evaluated immediately. +* *Symbols* (typically single words, or several words joined by dashes) are used to execute code that performs operations on the whole stack. Unlike more traditional programming languages, in a concatenative programming language there is no inherent need of variables or named parameters, as symbols acts as stack operators that consume elements that are placed in order on top of a stack.
M site/settings.jsonsite/settings.json

@@ -5,6 +5,6 @@ "templates": "templates",

"temp": "temp", "output": "output", "title": "min language", - "version": "0.19.4", + "version": "0.19.6", "rules": "rules.min" }