How-to initialize multiple empty blocks
[1/4] from: martin:middleton:speechworks at: 27-Aug-2001 12:15
Here's what I'm trying to do:
Let's say I have 3 objects named table1, table2, and table3.
In the interest of efficiency, I'm trying to pre load all 3 tables with the
same data, for example, a bunch of zeros. (I know I can do this at the time
I create the objects, but as a learning experience I'm trying to do this in
a simple for loop.)
The following doesn't do what I want, so how do I fix it?
tables: [table1 table2 table3]
foreach table tables [loop 10 [append table 0]]
All help is appreciated in advance.
- martin
[2/4] from: deadzaphod:flyingparty at: 27-Aug-2001 9:25
> The following doesn't do what I want, so how do I fix it?
>
> tables: [table1 table2 table3]
> foreach table tables [loop 10 [append table 0]]
table1: copy [] table2: copy [] table3: copy []
tables: reduce [table1 table2 table3]
foreach table tables [loop 10 [append table 0]]
Cal Dixon
[3/4] from: dockimbel::free::fr at: 27-Aug-2001 19:02
Hi Martin,
Martin Middleton wrote:
> Here's what I'm trying to do:
[...]
> tables: [table1 table2 table3]
> foreach table tables [loop 10 [append table 0]]
[...]
tables: [table1 table2 table3]
foreach table tables [set :table array/initial 10 0]
HTH,
DocKimbel.
[4/4] from: brian:hawley at: 28-Aug-2001 14:08
DocKimble wrote:
>Hi Martin,
>Martin Middleton wrote:
<<quoted lines omitted: 8>>
>HTH,
>DocKimbel.
set [table1 table2 table3] array/initial [3 10] 0
Even simpler :)
Brian Hawley
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted