Sujet : Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]
De : buzz_mccool (at) *nospam* yahoo.com (Buzz McCool)
Groupes : comp.lang.forthDate : 02. Sep 2024, 17:03:47
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vb4nl3$2tc5b$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 8/30/24 13:32, minforth wrote:
use locals if you have too many parameters
I like this quite a bit. Tell me if I like it too much.
: CylVolLoop {: W: StartHeight W: FinalHeight F: Radius -- Tabular Output :}
cr ." Radius " Radius fe.
StartHeight
begin dup FinalHeight <=
while
dup
s>f
fdup
cr ." Height " fe.
Radius
VolOfCyl
." Volume " fe.
1 +
repeat
drop
cr ;
17 20 1.0e CylVolLoop
Radius 1.0000E0
Height 17.000E0 Volume 53.407E0
Height 18.000E0 Volume 56.549E0
Height 19.000E0 Volume 59.690E0
Height 20.000E0 Volume 62.832E0