home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,642 of 117,927   
   albert@spenarnc.xs4all.nl to sjack   
   Re: recursion   
   17 Jul 24 11:48:12   
   
   In article , sjack  wrote:   
   >Anton Ertl  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.   
      
   I really doubt it is useful to avoid adding one definition   
   to the 1000+ that is already in gforth.   
   It is dangerous to use `myself in this context, obviously   
   `recurse doesn't cut it. So you are obliged to do a ton of   
   reading to avoid pitfalls.   
   By the way, I thought we are talking about the usefulness   
   slash unavoidability of forward definitions.   
      
   >--   
   >me   
      
   Groetjes Albert   
   --   
   Don't praise the day before the evening. One swallow doesn't make spring.   
   You must not say "hey" before you have crossed the bridge. Don't sell the   
   hide of the bear until you shot it. Better one bird in the hand than ten in   
   the air. First gain is a cat purring.            - the Wise from Antrim -   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca