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 117,006 of 117,927   
   dxf to Hans Bezemer   
   Re: "Back & Forth" - Local variables   
   09 Jan 25 09:50:52   
   
   From: dxforth@gmail.com   
      
   On 9/01/2025 5:11 am, Hans Bezemer wrote:   
   > On 08-01-2025 17:27, albert@spenarnc.xs4all.nl wrote:   
   >   
   > ( my CO variant, using the return address)   
   >   
   > : LOCAL R> SWAP DUP >R @ >R EXECUTE R> R> ! ;   
   >   
   > VARIABLE A   
   > VARIABLE B   
   >   
   > \ I'm paranoid :)   
   >   
   > 8 a !   
   > 7 b !   
   >   
   > : divide   
   >     A LOCAL   
   >     B LOCAL   
   >     B ! A !  A @ B @ /   
   >     . CR   
   > ;   
   >   
   > 15 3 divide a ? b ?   
   > \ it doesn't mean they're not out to get you   
   >   
   > Wow! This works! Can't say how solid it is.. but still!   
      
   Alas not portable.   
      
   If I'm playing this game (e.g. a routine needs to be re-entrant) then   
   I spell out what I'm doing.  Nobody gets confused and no surprises.   
      
   8 VALUE A   
   7 VALUE B   
      
   : divide   
       A B 2>R  TO B  TO A   
       A B /  . CR   
       2R> TO B TO A   
      
      
   15 3 divide a . b .   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

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


(c) 1994,  bbs@darkrealms.ca