Re: Star Trek by Krishna Myneni
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Star Trek by Krishna Myneni         

Group: comp.lang.forth · Group Profile
Author: Krishna Myneni
Date: Sep 20, 2008 07:48

Doug Hoffman wrote:
> Krishna Myneni wrote:
>> Doug Hoffman wrote:
>>> This might also be a problem:
>>>
>>>
>>> fvariable x
>>> ^^^^^^^^^^^
>>>
>>>
>>> : FirePhasers ( -- )
>>>
>>> ...
>>> cr ." NUMBER OF UNITS TO FIRE " #in X !
>>> ^^^
>>> e @ X @ - 0 >=
>>> UNTIL
>>>
>>> X @ 0> IF
>>> X @ negate e +!
>>> d{ 7 } f@ f0< IF X @ s>f ran0 f* fround>s X ! THEN
>>> X @ k3 @ / h1 ! \ distribute phaser energy among klingons present
>>>
>>> ( there may be more uses of @ and ! with x )
>>>
>>>
>>>
>>> -Doug
>>
>> This is not likely to be a problem as "x" is probably a temporary
>> fvariable, and use of "@" and "!" will not cause memory problems.
>
> What is a "temporary fvariable"? An flocal? Regardless, I don't see it
> defined anywhere. X is the same as x , right?
>

My grammar is poor. I should have said "x" is an fvariable that is used to
store temporary values. Yes, "X" is the same as "x".
> Is #in a local declarer? If so when I try to use it as in strek it
> clobbers the fvariable x. Example:
>

No, "#IN" is not intended to do that. Clobbering the value of "x" is permissible
as long as it is not done while the value is in use.
> fvariable x
> 56e x f!
> x f@ f.
> 56.000000 ok
>
> : t #in X ! ;
>
>
> t
> 6
>
> x f@ f.
> 0.000000 \ <= ????
>
> x @ .
> 6 ok
>
>
> -Doug

Krishna
no comments
diggit! del.icio.us! reddit!