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 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: References: <2024Jul15.152917@mips.complang.tuwien.ac.at> 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: 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