Sujet : Re: recursion
De : sjack (at) *nospam* dontemail.me (sjack)
Groupes : comp.lang.forthDate : 16. Jul 2024, 13:02:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v75ngv$18mqt$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : tin/2.6.2-20220130 ("Convalmore") (Linux/6.5.0-41-generic (x86_64))
Anton Ertl <
anton@mips.complang.tuwien.ac.at> wrote:
forward foo
: bar ( n -- ) dup . 1- foo ;
: foo ( n -- ) dup 0> if bar else drop then ;
5 foo \ prints "5 4 3 2 1 "
Toad code using Wil Baden type local macros ( /MM: MM ):
"dup . 1- myself" /mm: bar OK
: foo dup 0> if mm bar else drop then ; OK
5 foo 5 4 3 2 1 OK
Note: The macro BAR does not remain in the system image.
-- me