Sujet : Re: recursion
De : do-not-use (at) *nospam* swldwa.uk (Gerry Jackson)
Groupes : comp.lang.forthDate : 15. Jul 2024, 23:41:44
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v748j5$t15l$2@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
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