Deutsch   English   Français   Italiano  
<2ec5cfbd438db9be750543c9ebddfa6ffa17583c@i2pn2.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: dxf <dxforth@gmail.com>
Newsgroups: comp.lang.forth
Subject: Re: Back & Forth - Co-routines
Date: Tue, 11 Mar 2025 16:24:42 +1100
Organization: i2pn2 (i2pn.org)
Message-ID: <2ec5cfbd438db9be750543c9ebddfa6ffa17583c@i2pn2.org>
References: <nnd$2fb29a8e$298ef3f8@23fe4f00fa62d734>
 <49736c0ec0e34ca5d67f4e0d6e8cbe2a080e38ab@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 11 Mar 2025 05:24:42 -0000 (UTC)
Injection-Info: i2pn2.org;
	logging-data="3827930"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="XPw7UV90Iy7EOhY4YuUXhpdoEf5Vz7K+BsxA/Cx8bVc";
User-Agent: Mozilla Thunderbird
In-Reply-To: <49736c0ec0e34ca5d67f4e0d6e8cbe2a080e38ab@i2pn2.org>
Content-Language: en-GB
X-Spam-Checker-Version: SpamAssassin 4.0.0
Bytes: 1441
Lines: 20

Here's the simple locals paradigm using VALUEs.  OTOH it's likely
to be less portable than the VARIABLE-based one.

: ;: >r ;

: (local) ( x xt -- )  \ assume CREATE-based VALUEs
  r> -rot dup execute over 2>r  >body ! ;: 2r> >body ! ;

: LOCAL ( x "name" -- )
  '  postpone literal  postpone (local) ; immediate

\ behead (local) (local)

\ Example
8 value A  7 value B

: divide ( a b -- )  local b  local a
  a b /  . cr  ;

15 3 divide  a . b .