h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
311 stars 23 forks source link

Documentation Findings #49

Closed zenon closed 4 years ago

zenon commented 4 years ago

Some more comments on the documentation, to get it even better.

Kind greetings from Hamburg!


Types: z: You may mention that ints (and floats too, I presume) are 64 bit long.

3.4.3 z: spell: pervent -> prevent


in reference-stack

get-stack Returns a quotation containing the contents of the stack. z: The stack behavior explains what "returns" means. However, for a person coming from Forth, and looking for the equivalent of .s , it may be helpful to explicitly state: Puts a quotation containing the contents of the stack on the stack.

clear-stack z: The stack comment EmptyStack => EmptyStack is wrong, it should be something like: Anything => EmptyStack


reference-lang

apply If a dictionary dict is passed, it returns a new dictionary obtained by evaluating each symbol of dict in a separate stack. z: "each symbol" may mean keys as well as values, but here it seems to refer to values only. Suggestion: If a dictionary dict (with values and keys) is passed, it returns a new dictionary obtained by evaluating each value in the dict that is a symbol in a separate stack. (Values that aren't symbols stay as they are.)

1 :uno 2 :due 3 :tres 4 :quattro {uno :due tres :quattro} {1} -> { uno :due tres :quattro } apply {1} -> { 1 :due 3 :quattro }

side note that adding an apply solves our issues with the dict literal in the http example. like this:

{handler :handler 5555 :port} apply =server-parameters


bool If a is a non-zero numeric value, it is converted to true, otherwise it is converted to false. z: natural languages lack parentheses. This can be read as If a (is a non-zero numeric value, it is converted to true,) otherwise it is converted to false. The left hand side would apply to anything that is not a number. Suggestion: If a is a numeric value, zero is converted to false, otherwise it is converted to true. If a is a quotation, the empty quotation is converted to false, otherwise it is converted to true. If a is a string, the empty string and "false" are converted to false, otherwise it is converted to true.

Note: Any dictionary seems to get converted into true.

Note2: This might be nitpicking. Probably every of your readers understands what you intend :-)


dequote Pushes the contents of quotation quot on the stack. z: This seems to be something like a transaction. Suggestion (if I understand it correctly): Pushes the contents of quotation quot on the stack, as if the elements are put on the stack one by one; except that if any of them fails, the whole operation fails (and the quot stays on the stack).

h3rald commented 4 years ago

Thanks, as usual... 😊 Will have a look & fix.

zenon commented 4 years ago

As long as this is open, I'll add here :-)

5.1 Implementing new min modules using min itself

The example is a qotation, not a dict, as it should be.


linrec has some example code. It lacks the argument: 5