Sujet : Re: "Back & Forth" - Local variables
De : sjack (at) *nospam* dontemail.me (sjack)
Groupes : comp.lang.forthDate : 17. Mar 2025, 18:12:42
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vr9l6a$ivrn$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-55-generic (x86_64))
albert@spenarnc.xs4all.nl wrote:
i. {} --> 1 2 3 4
No what is that supposed to mean?
Ok, for the record then, Toad test and demo aids:
1) { ... }
Set a marker and compile the code within the braces.
2) {}
Executes the code compiled by { ... } but doesn't perform the marker,
therefore {} can execute the code multiple times if so desired.
The marker can be performed manually by performing {FIN} .
{FIN} is found in other words such as E or RUN1 (they the same)
which follow { ... } to do a one-time execution of the marked code.
Other words execute the code multiple times in a loop and performs
{FIN} when done:
i. RUN
Loops the code until TRUE is returned
i. RUNS
Loops the code n times
i. GRUN
Performs RUN and drops g-string that remained on stack
i. FORALL
Perform {} on all (counted) strings on the data stack
3) i.
Print " --> " .
It serves as a list item mark and also prints an arrow to indicate
the output of the words that follow.
Summary:
i. { ... } E \ run once
i. { ... } RUN1 \ ditto, run once
i. { ... } n RUNS \ run n times
i. { ... } RUN \ run while returned flag is TRUE
i. { ... } GRUN \ perform RUN and drop a remaining g-string
i. { ... } FORALL \ perform {} on each (counted) string on the data stack
Note: g-string is a generic string; it is referenced by address and
count on the data stack (standard Forth strings are g-strings)
-- me