Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: sjack@dontemail.me (sjack) Newsgroups: comp.lang.forth Subject: Re: "Back & Forth" - Local variables Date: Fri, 10 Jan 2025 15:50:47 -0000 (UTC) Organization: A noiseless patient Spider Lines: 23 Message-ID: References: <752c8e210166d00119336309dc35240d36d6f17d@i2pn2.org> <9747ef2be5ee93d6a4f0c89352a38cec72624609@i2pn2.org> <6a2d3e50f9435ebced9e72d5770af8ff75b6153e@i2pn2.org> <7f4d1c07f94e604c28d4f13ee6b7ecbe8138c28d@i2pn2.org> Injection-Date: Fri, 10 Jan 2025 16:50:48 +0100 (CET) Injection-Info: dont-email.me; posting-host="599b5d6e4491dea6e7fe1b0cc449069b"; logging-data="101995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uyCII/OEddvTIKYh8Y9Yc" User-Agent: tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-51-generic (x86_64)) Cancel-Lock: sha1:/zkS/CsIkEgYPtpG32yTHK3oiHg= Bytes: 1949 dxf 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