Deutsch   English   Français   Italiano  
<v748j5$t15l$2@dont-email.me>

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

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Gerry Jackson <do-not-use@swldwa.uk>
Newsgroups: comp.lang.forth
Subject: Re: recursion
Date: Mon, 15 Jul 2024 23:41:44 +0100
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <v748j5$t15l$2@dont-email.me>
References: <v6c8v0$3usoe$1@dont-email.me> <v71gpb$jsug$1@solani.org>
 <nnd$79e41f47$2235e236@caa216183355b959>
 <d8a7bf3190d012f4d6e588cf7f4f4ee1@www.novabbs.com>
 <2024Jul15.152917@mips.complang.tuwien.ac.at> <v73cm8$kvfk$1@solani.org>
 <v73tpv$qua9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 16 Jul 2024 00:41:41 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b38004594837479fa4d200f697103370";
	logging-data="951477"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Ur7OcwFAZ9TFptQ86EhMSAUTKvkai8yY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:afLOzzTLlt/0Yatq31A5hflHclk=
Content-Language: en-GB
In-Reply-To: <v73tpv$qua9$1@dont-email.me>
Bytes: 2204

On 15/07/2024 20:37, Ruvim wrote:
> 
>>>
>>> RECURSIVE also allows you to tick the word in its own definition (not
>>> possible with RECURSE), a feature that I actually have used;
> 
> I think, there should be a standard method to get the xt of the current 
> definition (regardless whether it is a named definition, or nameless 
> definition).
> 

It can be done by using DEFER as a forward definition
e.g.
defer foo
:noname ... ['] foo defer@ ... ; is foo

using DEFER@ gives the xt of the code, omittimg it gives the xt of the name.

as FOO can be called by name by executing
    synoname foo recurse
I would guess that your suggestion of FORWARD FOO could be defined using 
that and something like EXECUTE-PARSING e.g. copying "FOO RECURSE" to a 
buffer and doing:
   BUF COUNT ' SYNONYM EXECUTE-PARSING
followed by IMMEDIATE of course

As DEFER can be used as a forward definition it can also be used for 
mutual recursion

-- 
Gerry