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,711 of 117,927   
   Hans Bezemer to BuzzMcCool   
   Re: Avoid treating the stack as an array   
   05 Sep 24 17:18:07   
   
   From: the.beez.speaks@gmail.com   
      
   On 31-08-2024 07:59, BuzzMcCool wrote:   
   > On 8/30/24 18:05, dxf wrote:   
   >> On 31/08/2024 2:04 am, Buzz McCool wrote:   
   >>> ...   
   >>> Does anyone have suggestions on a better approach when you have   
   >>> several parameters and loop counts to deal with?   
   >>   
   >> I see little wrong with your example other than cosmetics - excess   
   >> comments   
   >> that don't add value and missing stack parameter comment in colon   
   >> definitions.   
   >>   
   >   
   > Thanks for the feedback. Yes I do need to work on my stack parameter   
   > comments.   
   Given that the area of the circle doesn't change - why recalculate that   
   every time? Ok, I changed VolOfCirc a bit, but it saves me both time and   
   complexity. Note this only works if there is a separate FP stack. Which   
   is the standard nowadays.   
      
   Alternatives:   
   1. Change the order of parameters (float last);   
   2. Change the order of parameters (carnal knowledge of the size of a float);   
   3. Specify the radius as an integer.   
      
   : AreaOfCir fdup pi f* f* ;   
   : VolOfCyl f* ;   
      
   : CylVolLoop   
      cr ." Radius " fdup fe.   
      AreaOfCir 1+ swap ?do   
        i s>f fdup cr ." Height " fe.   
        fover VolOfCyl ." Volume " fe.   
      loop fdrop   
      
      
   Hans Bezemer   
      
   --- 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