Sujet : Re: "Back & Forth" - Local variables
De : sjack (at) *nospam* dontemail.me (sjack)
Groupes : comp.lang.forthDate : 10. Jan 2025, 16:50:47
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vlrfkn$33jb$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-51-generic (x86_64))
dxf <
dxforth@gmail.com> wrote:
Great. While I've seen co-routines mentioned, examples were rare so I
tended to ignore it.
-- A closed paren defined as an immediate co-routine can be used at
-- compile time to divide a word into two parts.
-- At run-time the word's first part executes then performs co-routine
-- and somewhere down the input ')' performs co-routine to return control
-- back to the the word's second part.
-- : foo( first part ) second part ;
-- Example:
: foo( ." --> " s0 @ sp! ) begin depth while 5 * . repeat ; OK
foo( 3 2 1 ) --> 5 10 15 OK
I use 'hi( foo bar baz )' to highlight the output of a sequence of
Forth words.
-- me