Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > The word RECURS...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 3947 of 4136
Post > Topic >>

The word RECURSE

by <Montesquiou> Mar 22, 2008 at 09:42 AM

Hello, Bonjour to all,
I have a nice (short and compact) Forth written in 1983 by the Brazilian 
Professor Antônio Costa for the TRS80 and later for the ZX-81 by Tomas Löw
http://www.zx81.megahospedagem.com.br/msprog.htm
look at "Forth  Autor:  Tomas Löw Edição 39 - Dezembro  1984 "
It works fine on both emulators VB81_XuR and eightyone.

When I have something like
: word
     begin action condition? until
  ;
I am trying to implement the word RECURSE, similar to
: word
      action condition?
      if exit
      then
        RECURSE
   ;

I am looking for a definition of RECURSE  in Forth-79.
My first try was
: RECURSE
         CONTEXT @[EMAIL PROTECTED]
 @[EMAIL PROTECTED]
 DUP
          c@[EMAIL PROTECTED]
 + 5 + *N *WHILE END,
 ; IMMEDIATE
Where *WHILE is the compilation adress of WHILE - *N *WHILE put the adress

of *WHILE on the stack and the definition of END, is
: END,
     , HERE - c,
   ; IMMEDIATE

However it don't work with
: factorial  ( n -- n! )
    dup 1 >  if   dup 1-  recurse  *  then
 ;
Any Idea ?
Thank you and sorry for my poor english.
 




 8 Posts in Topic:
The word RECURSE
<Montesquiou>   2008-03-22 09:42:49 
Re: The word RECURSE
mhx@[EMAIL PROTECTED] (M  2008-03-22 10:24:50 
Re: The word RECURSE
<Montesquiou>   2008-03-22 11:04:42 
Re: The word RECURSE
anton@[EMAIL PROTECTED]   2008-03-22 09:48:25 
Re: The word RECURSE
<Montesquiou>   2008-03-22 11:20:10 
Re: The word RECURSE
<Montesquiou>   2008-03-22 15:02:07 
Re: The word RECURSE
mhx@[EMAIL PROTECTED] (M  2008-03-22 16:02:57 
Re: The word RECURSE
<Montesquiou>   2008-03-22 18:47:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 5:54:30 CDT 2008.