all repos — min @ d68f0c21a780664403827da28603c370f3fc53d6

A small but practical concatenative programming language.

Doc fixes.
h3rald h3rald@h3rald.com
Mon, 27 Dec 2021 21:56:36 +0000
commit

d68f0c21a780664403827da28603c370f3fc53d6

parent

c82e7cfd5f54831a3529aad300e2172c95f98795

M site/contents/learn-definitions.mdsite/contents/learn-definitions.md

@@ -14,12 +14,12 @@ 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 literals of course. +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). Consider the following program: :filepath - filepath "\.zip$" match + filepath "\.zip$" match? filepath fsize 1000000 > filepath mtime now 3600 - > and and
M site/contents/reference-lang.mdsite/contents/reference-lang.md

@@ -234,6 +234,10 @@ Defines a new symbol {{sl}}, containing the specified quotation {{q}}. Unlike with `define`, in this case {{q}} will not be quoted, so its values will be pushed on the stack when the symbol {{sl}} is pushed on the stack.

Essentially, this symbol allows you to define an operator without any validation of constraints and bind it to a symbol.#} +{#op||lambda-bind||{{q}} {{sl}}||{{none}}|| +Binds the specified quotation to an existing symbol {{sl}} which was previously-set via `lambda`. #} + + {#op||line-info||{{none}}||{{d}}|| Returns a dictionary {{d}} containing a **filename**, **line**, and **column** properties identifying the filename, line and column of the current symbol.#}

@@ -250,7 +254,7 @@ > > Example

> > > > The following program leaves `120` on the stack, the factorial of 5: > > -> > 5 (dup 0 ==) 'succ (dup pred) '* linrec +> > 5 (dup 0 ==) 'succ (dup pred) '* linrec #} {#op||load||{{sl}}||{{a0p}}||
M site/contents/reference-seq.mdsite/contents/reference-seq.md

@@ -132,8 +132,8 @@

{#op||quote-map||{{q1}}||{{q2}}|| Returns a new quotation {{q2}} obtained by quoting each element of {{q1}}.#} -{#op||reduce||{{q1}} {{any}} {{q2}}||{{i}}|| -> Combines each successive element of {{q1}} using {{q2}}. On the first iteration, the first two inputs processed by {{q2}} are {{any}} and the first element of {{q1}}. +{#op||reduce||{{q1}} {{a1}} {{q2}}||{{a2}}|| +> Combines each successive element of {{q1}} using {{q2}}. On the first iteration, the first two inputs processed by {{q2}} are {{a1}} and the first element of {{q1}}. > > > %sidebar% > > Example