Etoys - arrays/lists?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Etoys - arrays/lists?

R.D. Latimer
Is there a way to create an array or list of numbers - many numbers, like 100 or 1000 or more?

From the Illinois website it looks as though a Holder is the only way to do this, copy in a Text object for each array/list element.
This method doesn't seem to be the way to store large numbers of values into an array or list.

This may mean also that there are no list accessing means, like to check if a particular value is in a list. 
Thanks for any help,
Randy Latimer

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Etoys - arrays/lists?

Yoshiki Ohshima-2
At Tue, 11 Oct 2011 21:46:15 -0400,
R.D. Latimer wrote:
>
> Is there a way to create an array or list of numbers - many numbers, like 100 or 1000 or more?
>
> From the Illinois website it looks as though a Holder is the only way to do this, copy in a Text object for each array/list element.
> This method doesn't seem to be the way to store large numbers of values into an array or list.

  "Doesn't seem to be"...  But can you elaborate a little bit more?
It may be actually feasible with Text object.  But, yes, such kind of
large collection is not a common Etoys feature.

  You could always resort to the textual coding and use full
Collection library.  But...

> This may mean also that there are no list accessing means, like to check if a particular value is in a list.
> Thanks for any help,

  There is another tricky way to do it with Particles.

I made a project to demonstrate it:

http://squeakland.org/launcher?http://dev.laptop.org/~yoshiki/etoys/KedamaInclusionTest.001.pr

There are 10,000 random number between 0 and 999999, created by the
"setup" script.  Then type in a number you would like to query in the
"query" watcher and press "turtle2 try".  If the "query" number is
among these 10,000 numbers, "result" will be true.  Otherwise, it'll
be false.

-- Yoshiki
_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Etoys - arrays/lists?

dcorking
> R.D. Latimer wrote:
>>
>> Is there a way to create an array or list of numbers - many numbers, like 100 or 1000 or more?
>>
>> From the Illinois website it looks as though a Holder is the only way to do this, copy in a Text object for each array/list element.
>> This method doesn't seem to be the way to store large numbers of values into an array or list.

Yoshiki  wrote:
>  "Doesn't seem to be"...  But can you elaborate a little bit more?
> It may be actually feasible with Text object.  But, yes, such kind of
> large collection is not a common Etoys feature.

I once created a grid of the first 100 natural numbers: it wasn't
pretty to create and took a few minutes of copy and paste. I ended up
with a holder of holders (each containing a row of 10 Text objects.)

So it can be done but I think Yoshiki's suggestions of particles or
textual script would be better.
_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Etoys - arrays/lists?

R.D. Latimer
Thanks,
 I'll try Yoshiki's particle version.  For instance, in a simple coin toss program, it may be good to store percentages of heads/tails for numerous trials, like flipping a coin 10 times, get the percentage of heads, and run this trial 1000 times.
 Or pick 50 random numbers from 1-500 and see how many match, are do they tend to be all unique.
 Or in a projectile program, it may be good to store x,y positions in two arrays/lists, one for x positions, one for y positions.

Thanks again,
Randy Latimer

On Wed, Oct 12, 2011 at 4:12 AM, David Corking <[hidden email]> wrote:
> R.D. Latimer wrote:
>>
>> Is there a way to create an array or list of numbers - many numbers, like 100 or 1000 or more?
>>
>> From the Illinois website it looks as though a Holder is the only way to do this, copy in a Text object for each array/list element.
>> This method doesn't seem to be the way to store large numbers of values into an array or list.

Yoshiki  wrote:
>  "Doesn't seem to be"...  But can you elaborate a little bit more?
> It may be actually feasible with Text object.  But, yes, such kind of
> large collection is not a common Etoys feature.

I once created a grid of the first 100 natural numbers: it wasn't
pretty to create and took a few minutes of copy and paste. I ended up
with a holder of holders (each containing a row of 10 Text objects.)

So it can be done but I think Yoshiki's suggestions of particles or
textual script would be better.
_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland


_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Etoys - arrays/lists?

Steve Thomas
On Wed, Oct 12, 2011 at 7:23 AM, R.D. Latimer <[hidden email]> wrote:
For instance, in a simple coin toss program, it may be good to store percentages of heads/tails for numerous trials, like flipping a coin 10 times, get the percentage of heads, and run this trial 1000 times.
For kids it would be nice to visually show the percentages changing over time as well see sample image below. 
Coin Flippin%0D.png

I also updated my Coin Toss project to include a page and scripts to do this.

Stephen


_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Etoys - arrays/lists?

Yoshiki Ohshima-2
In reply to this post by R.D. Latimer
At Wed, 12 Oct 2011 07:23:36 -0400,
R.D. Latimer wrote:
>
> Thanks,
>  I'll try Yoshiki's particle version.  For instance, in a simple coin toss program, it may be good to store percentages of heads/tails for numerous trials, like flipping
> a coin 10 times, get the percentage of heads, and run this trial 1000 times.
>  Or pick 50 random numbers from 1-500 and see how many match, are do they tend to be all unique.
>  Or in a projectile program, it may be good to store x,y positions in two arrays/lists, one for x positions, one for y positions.

  Just food for thought, here is one instance of such:

http://squeakland.org/launcher?http://dev.laptop.org/~yoshiki/etoys/MonteCarlo%20Pi.003.pr

In fact, using real objects x and y would be another way to do it.
For each try, you create a copy of small rectangle and set its x and y
to the value you want to record.

-- Yoshiki
_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland