"Anton Ertl" <anton@[EMAIL PROTECTED]
> a écrit dans le message de
news: 2008Mar22.104825@[EMAIL PROTECTED]
> <Montesquiou> writes:
>>I am looking for a definition of RECURSE in Forth-79.
>>My first try was
>>: RECURSE
>> CONTEXT @[EMAIL PROTECTED]
@[EMAIL PROTECTED]
DUP
>
> Why CONTEXT? I would rather expect CURRENT.
>
> Anyway, if your Forth has words like LATEST (or LAST) and NFA>,
> something like
>
> : recurse latest nfa> , ; immediate
>
> might work. IIRC the classical definition of LATEST was:
>
> : latest current @[EMAIL PROTECTED]
@[EMAIL PROTECTED]
;
>
> - anton
Great !
: last current @[EMAIL PROTECTED]
@[EMAIL PROTECTED]
;
: nfa> dup c@[EMAIL PROTECTED]
1+ + 2+ ;
: recurse last nfa> , ; immediate
: factorial dup 1 > if dup 1 - recurse * then ;
It works fine ! Thank you, obrigado.
> --
> M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
> comp.lang.forth FAQs:
http://www.complang.tuwien.ac.at/forth/faq/toc.html
> New standard: http://www.forth200x.org/forth200x.html
> EuroForth 2008:
> http://www.complang.tuwien.ac.at/anton/euroforth/ef08.html