This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#51 2008-05-27 04:07:24

iwansuryo
Scratcher
Registered: 2008-05-16
Posts: 29

Re: Lists for Scratch

I still don't understand how to call and save unique step from the list variables. For example, I want to call and save only step 2, 4, 6,.... or 3, 6, 9, ... or prime series from a list variable. I have tried many way to do this but cannot give result what I am looking for. Could you give me a hint?

The second problem is the file format of output list (*.lst). If I want to open this file with notepad, it cannot be read as usual number. I want to import this file to spreadsheet like Microsoft Excel so that I can archiving and processing data array which I get from sensor board. Anybody can help me about this?

Thank you in advance.

Iwan Suryolaksono

Offline

 

#52 2008-05-27 04:32:45

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Lists for Scratch

Hi Iwan,

Thank you for your interest in my lists and files implementation! Let me try to answer your questions:

accessing specific parts of a list by their indices
You can filter out any parts of a list into another one by copying the values you're interested in from the source list into the target list, e.g.

   add (sourceList at 2) to targetList
   add (sourceList at 4) to targetList
   add (sourceList at 6) to targetList
   ...

Of course you can accomplish this also using a loop and an index variable, if it's a regular series of intervals you're after.

Another way to copy a specific range of indices in a list is to use the range block:

   add sourceList (startIndex) to (endIndex) to targetList

Afterwards you can save the target using the

   write 'filename' for targetList

command block

accessing a specific value
If you don't know the index of the value you're interested in (e.g. if you want to parse certain parts of a concatenated list) you need to find its index first. You can accomplish this using the

   first pos/las pos of (num) in myList

reporter block (you can also achieve this by iterating through the whole list and comparing the values for each index).

the file format
The file format of the external list files is currently a binary one, which can only be read by the lists application. You cannot edit it in an external editor. For performance reasons (binary is much faster than text) I decided to make it a binary format, so even very long lists (with thousands of indices) can be stored/retreived at an instant. I have, however, plans to let the user eventually export lists in an XML format (I've already created the DOM/parser for that), which could then be edited in all kinds of external apps.

I like the idea of combining lists with the sensor board, btw!

Did that answer your questions?


Jens Mönig

Offline

 

#53 2008-05-28 04:12:27

iwansuryo
Scratcher
Registered: 2008-05-16
Posts: 29

Re: Lists for Scratch

Ok, thanks for your answer Jens. I think the beautiful thing to do with List Scratch is to use it to record and process data from ScratchBoard that can widely interact with many variables in nature real time. If the list data which we get from ScratchBoard cannot be save and read from other application, then the usage of List Scratch would be very limited.

For now, I am doing a project to expand the functionality of List Scratch and ScratchBoard to make module for experimenting with biology and physics science. I hope that full impelementation of list variables within Scratch could be implemented very soon.

Iwan Suryolaksono
Indonesia

Offline

 

#54 2008-05-28 04:28:30

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Lists for Scratch

That's extremely interesting, Iwan, and I'd like to learn more about what exactly you're experimenting with!

As I pointed out I already have an XML DOM/Parser for Scratch ready. Which format structure should these lists have? I have been considering something like:

Code:

<list>
   <value index="1">12</value>
   <value index="18">8</value>
   <value index="207">78</value>
   <value index="1067">3</value>
   ...
</list>

That way empty slots wouldn't have to be written/read. Would this help you?

Would you need to be able to export/import such text-based lists from presentation mode (i.e. with a command block), or would you prefer manually exporting/importing them using the context-menu in the IDE?


Jens Mönig

Offline

 

#55 2008-05-28 04:58:18

iwansuryo
Scratcher
Registered: 2008-05-16
Posts: 29

Re: Lists for Scratch

Thanks very much Jens, for your quick answer.

I think the null index should be reporting with null value, so that it woold be easier to do specific calculation within spreadsheet with many variables. As far I know, XML data could be read in Excel but the null value must be declared.

I can give you a little illustration of my project. If we want to observe the growth of plant, so many variable in climate, soil, and organ of the plant that interact dynamically. The observation would be take several day or maybe several week. If we want to study such interaction, and make a model that can explain why it happened, it has to be supported with many list variables. From simple program that give a warning when a plant going thirsty to total observation of many variable, children can construct their own unique model of specific plant that they observed.

Iwan S

Offline

 

#56 2008-05-28 06:53:01

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Lists for Scratch

Okay, Iwan, let's discuss this a little further, I'm sure we can extend my current List implementation very quickly to meet your needs:

I understand that you would need XML list files to always include all slots, answering zero for nil (just the way how my Lists behave in the IDE). That shouldn't be a problem.

How about my second question: Do you need/prefer a command block for export/import, or rather an entry in a (context) menu in the IDE?

My suggestion would be to add an additional entry in the drop-down menu of the current file-block named "write XML". When reading an external list file the app would determine by itself if it is in binary or text form. What do you think?


Jens Mönig

Offline

 

#57 2008-05-29 05:51:17

iwansuryo
Scratcher
Registered: 2008-05-16
Posts: 29

Re: Lists for Scratch

Thank you very much Jens,

For the option to save file output from list variables, I agree with you, it woud be more convenient to use menu from IDE.

But I want to discuss another problem. Right now I tried to expand the resistance sensor from ScratchBoard using multiplexer as a switch. From our preliminary design, we can make four new resistance sensor as a replacement for every sensor, so that we can get totally sixteen resistance sensor. With this design, every input from resistance sensor is divided by different time sampling. This is why I am asking you about how to spread from one list variable into multiple list variable with their specific "index series". But now I have   problem in determining which index represent which resistance sensor because the difference between startup program and startup sensorboard.

I think it is beyond the scope of list variables. But I hope we can discuss about it more comprehensive.

Iwan S.

Offline

 

#58 2008-05-29 10:00:54

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Lists for Scratch

Thanks, Iwan, for your answer. Your exciting project description has me got me hooked!

I'm not sure if or when Scratch will support lists, and if/how they will be exportable to disk. Lists are probably high on the Scratch developers' "nice-to-have-agenda", and I suspended integrating my own list implementation into Chirp because I don't really want to create an incompatible Scratch variant. However, I find your ideas so inspiring that I'd like to offer my feeble support.

list data export/import to XML
I think I can help you with the list part by extending my own prototypical implementation to include XML output/input of lists. That way you will be able to process such collected list data in external applications, such as data bases or spreadsheets.
(A side note: It might also be cool to evaluate this data in another Scratch project, drawing charts using the pen command blocks. That's why I have included a stats block in my lists-version...)

Once Scratch will officially have its own list extension I could support the XMl-file interface in Chirp, so you will still be able to use your (old) collected data in the new Scratch version. If you want to reuse your Scratch projects, however, you will eventually have to rebuild them in Scratch or Chirp...

I can't give you any estimate right now, when I'll have this ready, because I'm currently on a somewhat tight schedule, but it'll probably be within the next two weeks. Is that okay with you?

collecting data from time-division-multiplexed sub-sensors
Here all I can do is offer some wild guesses, since I'm neither an engineer (I'm just an attorney) nor do I yet own a ScratchBoard:

I'd suggest maintaining a separate list for each of your 16 "real world" sensors and constructing a demultiplexing mechanism using a combination of Scratch command blocks and an initial synchronized "senseable" outside event (like a flash of light or a <button pressed>), rather than project/sensor launch. Does that make any sense at all (perhaps someone knowledgeable from the community can chime into this, please....)?


Jens Mönig

Offline

 

#59 2008-06-12 14:39:31

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Lists for Scratch

If we had arrays or lists of any sort, here is what I would make in the first 5 minutes of getting them: http://www.onemorelevel.com/game/cursor10


All your base are belong to us

Offline

 

#60 2008-07-12 17:03:30

Digimath
Scratcher
Registered: 2007-07-07
Posts: 100+

Re: Lists for Scratch

Jens,

You’ve done an outstanding job.  You’ve designed a well-crafted set of highly-sought and badly needed extensions and you’ve done it a way that, at least to my eyes, would fit seamlessly into the Scratch IDE.

Because this would be such a major enhancement for Scratch, I hope you don’t mind if I take on the role of devil's advocate.  I don’t think the question is whether these features are needed or if they would be used enough by the Scratch community to make to it worth the effort by Scratch programming team to adopt your changes.   I think the question is what impact does this have on the intended community of Scratch users.

If the intended purpose of Scratch is to reach out to young people who have never programmed before then it is possible that Scratch best serves those users by remaining a minimalist language.  Of course one could suggest that the novice programmer just ignore these new blocks but will that be possible?  Isn’t it likely that once these features are added they will permeate every part of the Scratch culture.  They will be in the projects that a novice programmer will download to try and "creatively appropriate".  They will be talked about throughout the forums and will probably be mentioned in the advice given to them.

It’s understandable that programmers soon find the Scratch programming nest to be too confining and take wing.  Where do they go?  Who knows.  Java, Flash, Python, and other languages have been suggested.

What might best serve the Scratch community would be for Chirp to become its own official offering with your proposed extensions.  Then the migration path away from Scratch would be a more obvious and gentler hop.


I've updated my text adventure game.
Colossal Cave 150http://scratch.mit.edu/static/projects/Digimath/3003787_sm.png

Offline

 

#61 2008-07-14 03:40:47

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Lists for Scratch

Digimath,

thanks for your mindful thoughts on these issues. I'm actually more in agreement with your points than you might expect, and very much in favor of keeping Scratch overall simple and minimalistic. I feel, though, that some form of list-support would be a great improvement for Scratch, but it should probably be something much more simple along my very first four-block design, and also feature some graphical interactive "watcher", which could be edited onstage.

There have been many excellent and inspiring discussions (such as this one) about lists with other community members as well as with members of the Scratch Team. In fact, that's why I haven't pursued integrating lists into Chirp any further for the moment, while such discussions are still ongoing  smile


Jens Mönig

Offline

 

#62 2008-07-14 05:21:44

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: Lists for Scratch

Cyclone103 wrote:

If we had arrays or lists of any sort, here is what I would make in the first 5 minutes of getting them: http://www.onemorelevel.com/game/cursor10

Sorry Jens for this comment out of topic, but the game Cyclone103 would like to replicate is crazy and fun! Go ahead Cyclone103!

Offline

 

#63 2008-07-14 05:52:27

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: Lists for Scratch

Jens wrote:

I feel, though, that some form of list-support would be a great improvement for Scratch, but it should probably be something much more simple along my very first four-block design, and also feature some graphical interactive "watcher", which could be edited onstage

(I was writing down my  long opinion about new features in Scratch, but then I clicked the not-very-wisely-placed page-back button of my PC keyboard... SO close to the left arrow key... I lost it and I have to start from scratch... sorry if this time a will be a little more concise)

1. Lists are an important concept of computer science. They should be integrated in Scratch, but that must be done by keeping in mind the right pedagogial way of doing it, so waiting for as long as it take to design a mature form of them is good

2. For expert Scratchers, it come very soon the time to move to a more mature programming language. But more mature doesn't mean dry and boring as normal programming languages (Java, C, ecc. I do love them, but they ARE boring). In a mature form of Scratch-The-Language, they should be able to handle:
- list/arrays
- reading/saving of files
- dynamic creation of sprites (by programmatically designing them, or importing them from graphic files)
- a find/replace dialog (to replace variables, to know who and where is sending/receiving  a particular message, etc)
- (I had something else in my lost reply, I will add it when I remember that)

Scratch-The-Language will represent a more natural transition from Scratch to a full featured and more efficient programming language. Waiting for all these features to be added in the right way in Scratch-The-Language IDE is not worth it. They should be added as soon as possible, a general applet to have them running in a web browser should be made available. And then, Scratch-The-Language will have time to move from its very first implementations to always better ones. Expert scratchers won't be bothered by having to change something in their programs.

Will CHIRP be the new Scratch-The-Language? Why not? Or should we have an "advanced" button in the Scratch IDE that will deploy the full power of Scratch-The-Language without annoying the new scratchers when they see Scratch for the very first time? Maybe. I think I would support better the first scenario.

Last edited by s_federici (2008-07-14 05:53:00)

Offline

 

#64 2009-05-06 21:39:11

Sonor44
Scratcher
Registered: 2008-12-27
Posts: 5

Re: Lists for Scratch

it doesn't download for me!!!

Offline

 

Board footer