1. atom question
if I have many atoms:
atom a1,a2,a3,a4,a5
and want all set to a value, 2 or example
do I have to do it one at a time :
a1=2
a2=2
.
.
.
This is very time consuming.
it would be useful if this could be used:
a1=a2=a3=a4=a5=2
or even better:
atom a1=a2=a3=a4=a5=2
One way is also if I use another type which automatically assigns value,
which must be assigned often (0,1):
global type atom0(atom a)
a=0
return true
end type
but this apparently slows down the program?
Is there any other way of quickly assigning same value to many atoms?
2. Re: atom question
<tone.skoda at SIOL.NET> wrote:
>if I have many atoms:
>
>atom a1,a2,a3,a4,a5
>
>and want all set to a value, 2 or example
>
>do I have to do it one at a time :
>a1=2
>a2=2
>.
>.
>.
>This is very time consuming.
>
>it would be useful if this could be used:
>a1=a2=a3=a4=a5=2
>or even better:
>atom a1=a2=a3=a4=a5=2
>
>One way is also if I use another type which automatically assigns value,
>which must be assigned often (0,1):
>
>global type atom0(atom a)
> a=0
> return true
>end type
>
>but this apparently slows down the program?
>
>Is there any other way of quickly assigning same value to many atoms?
Use a sequence.
Everett L.(Rett) Williams
rett at gvtc.com
3. Re: atom question
On Sun, 19 Mar 2000, <tone.skoda at SIOL.NET> wrote:
> if I have many atoms:
>
> atom a1,a2,a3,a4,a5
>
> and want all set to a value, 2 or example
>
> do I have to do it one at a time :
> a1=2
> a2=2
> .
> ..
> ..
> TThis is very time consuming.
>
> it would be useful if this could be used:
> a1=a2=a3=a4=a5=2
> or even better:
> atom a1=a2=a3=a4=a5=2
You can make an array out of this:
sequence a
a = repeat(5,2) -- sets up 5 "a"s which are all set to equal 2
Then you reference them as a[1] a[4] etc.
> One way is also if I use another type which automatically assigns value,
> which must be assigned often (0,1):
>
> global type atom0(atom a)
> a=0
> return true
> end type
>
> but this apparently slows down the program?
Type checking does slow down your program, but the line a=0 above
will do nothing. The assignment a=0 only changes the copy of atom a
which is local to this routine. The value of the real variable is not changed.
i.e.
atom0 myatom
myatom = 56
after type checking, myatom will still equal 56.
Regards,
Irv