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

#6576 2013-01-17 10:01:23

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Also, try the second script in this project:

Code:

<project name="Iterators" app="Snap! 4.0, http://snap.berkeley.edu" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAADIUlEQVR4Ae3WwUlkARRE0d/DxKFoRrozIyMxARfmonm4dVQQBodmoCgokPM32q3vPTxcaE9v78/hITAS+DW66yyBTwEBCmEqIMApv+MC1MBUQIBTfscFqIGpgACn/I4LUANTAQFO+R0XoAamAgKc8jsuQA1MBQQ45XdcgBqYCghwyu+4ADUwFRDglN9xAWpgKiDAKb/jAtTAVECAU37HBaiBqYAAp/yOC1ADUwEBTvkdF6AGpgICnPI7LkANTAUEOOV3XIAamAoIcMrvuAA1MBUQ4JTfcQFqYCogwCm/4wLUwFRAgFN+xwWogamAAKf8jgtQA1MBAU75HRegBqYCApzyOy5ADUwFBDjld1yAGpgKCHDK77gANTAVEOCU33EBamAqIMApv+MC1MBUQIBTfscFqIGpgACn/I4LUANTAQGe4b+4uDgeHh7O/NTbLYHT2/vTWvbT9tze3h5fPM/Pz8fj4+NxfX390/7M6d8jwP/w39zc/PMbp9PpeH19PZ6eno6P7z25gI/g0E54Idy3sd/fXnv5l8DHR/DX8/Ly8vkRfHV19fWWrwUBAZ5BvLy8PO7v74+7u7szv+HthoD/ARuKdsQC/geM6Qw2BATYULQjFhBgTGewISDAhqIdsYAAYzqDDQEBNhTtiAUEGNMZbAgIsKFoRywgwJjOYENAgA1FO2IBAcZ0BhsCAmwo2hELCDCmM9gQEGBD0Y5YQIAxncGGgAAbinbEAgKM6Qw2BATYULQjFhBgTGewISDAhqIdsYAAYzqDDQEBNhTtiAUEGNMZbAgIsKFoRywgwJjOYENAgA1FO2IBAcZ0BhsCAmwo2hELCDCmM9gQEGBD0Y5YQIAxncGGgAAbinbEAgKM6Qw2BATYULQjFhBgTGewISDAhqIdsYAAYzqDDQEBNhTtiAUEGNMZbAgIsKFoRywgwJjOYENAgA1FO2IBAcZ0BhsCAmwo2hELCDCmM9gQEGBD0Y5YQIAxncGGgAAbinbEAgKM6Qw2BATYULQjFhBgTGewISDAhqIdsYAAYzqDDQEBNhTtiAUEGNMZbAgIsKFoRyzwB9UYKzMr6RmVAAAAAElFTkSuQmCC</thumbnail><stage name="Stage" costume="0" tempo="60" threadsafe="false" id="1"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAOiklEQVR4Ae3VwQkAIAwEQbX/niM24X4mDRwMgd0zsxwBAgQIECDwV+D8nbNGgAABAgQIPAEB9gcECBAgQCAQEOAA3SQBAgQIEBBgP0CAAAECBAIBAQ7QTRIgQIAAAQH2AwQIECBAIBAQ4ADdJAECBAgQEGA/QIAAAQIEAgEBDtBNEiBAgAABAfYDBAgQIEAgEBDgAN0kAQIECBAQYD9AgAABAgQCAQEO0E0SIECAAAEB9gMECBAgQCAQEOAA3SQBAgQIEBBgP0CAAAECBAIBAQ7QTRIgQIAAAQH2AwQIECBAIBAQ4ADdJAECBAgQEGA/QIAAAQIEAgEBDtBNEiBAgAABAfYDBAgQIEAgEBDgAN0kAQIECBAQYD9AgAABAgQCAQEO0E0SIECAAAEB9gMECBAgQCAQEOAA3SQBAgQIEBBgP0CAAAECBAIBAQ7QTRIgQIAAAQH2AwQIECBAIBAQ4ADdJAECBAgQEGA/QIAAAQIEAgEBDtBNEiBAgAABAfYDBAgQIEAgEBDgAN0kAQIECBAQYD9AgAABAgQCAQEO0E0SIECAAAEB9gMECBAgQCAQEOAA3SQBAgQIEBBgP0CAAAECBAIBAQ7QTRIgQIAAAQH2AwQIECBAIBAQ4ADdJAECBAgQEGA/QIAAAQIEAgEBDtBNEiBAgAABAfYDBAgQIEAgEBDgAN0kAQIECBAQYD9AgAABAgQCAQEO0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zaZQGfQAAAAASUVORK5CYII=</pentrails><costumes><list id="2"></list></costumes><sounds><list id="3"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites><sprite name="Sprite" idx="1" x="0" y="0" heading="90" scale="1" rotation="1" draggable="true" costume="0" color="80,80,80" id="8"><costumes><list id="9"></list></costumes><sounds><list id="10"></list></sounds><variables></variables><blocks></blocks><scripts><script x="20" y="20"><block s="receiveGo"></block><custom-block s="for %upvar in %s %cs"><l>i</l><block s="reportNewList"><list><l>Snap!</l><l>&gt;</l><l>BYOB 3.1</l><l>&gt;</l><l>Scratch</l></list></block><script><block s="doSayFor"><l>Next word</l><l>0.6</l></block><custom-block s="for %upvar in %s %cs"><l>j</l><block var="i"/><script><block s="doSayFor"><block var="j"/><l>0.6</l></block></script></custom-block></script></custom-block></script><script x="20" y="186"><block s="receiveKey"><l><option>space</option></l></block><custom-block s="for %upvar in %s %cs"><l>table</l><custom-block s="%repRing for %upvar in %s"><block s="reifyReporter"><autolambda><block s="reportJoinWords"><list><block var="out"/><l>*</l><l>3</l><l>=</l><block s="reportProduct"><block var="out"/><l>3</l></block></list></block></autolambda><list></list></block><l>out</l><l>10</l></custom-block><script><block s="doSayFor"><block var="table"/><l>0.6</l></block></script></custom-block></script></scripts></sprite></sprites></stage><blocks><block-definition s="for %&apos;i&apos; in %&apos;val&apos; %&apos;action&apos;" type="command" category="control"><inputs><input type="%upvar"></input><input type="%s"></input><input type="%cs"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="val"/><l><option>number</option></l></block><script><block s="doSetVar"><l>i</l><l>0</l></block><block s="doRepeat"><block var="val"/><script><block s="doChangeVar"><l>i</l><l>1</l></block><block s="doRun"><block var="action"/><list></list></block></script></block></script></block><block s="doIf"><block s="reportIsA"><block var="val"/><l><option>text</option></l></block><script><custom-block s="for %upvar in %s %cs"><l>char</l><block s="reportStringSize"><block var="val"/></block><script><block s="doSetVar"><l>i</l><block s="reportLetter"><block var="char"/><block var="val"/></block></block><block s="doRun"><block var="action"/><list></list></block></script></custom-block></script></block><block s="doIf"><block s="reportIsA"><block var="val"/><l><option>list</option></l></block><script><custom-block s="for %upvar in %s %cs"><l>item</l><block s="reportListLength"><block var="val"/></block><script><block s="doSetVar"><l>i</l><block s="reportListItem"><block var="item"/><block var="val"/></block></block><block s="doRun"><block var="action"/><list></list></block></script></custom-block></script></block></script></block-definition><block-definition s="%&apos;expr&apos; for %&apos;out&apos; in %&apos;iterable&apos;" type="reporter" category="control"><inputs><input type="%repRing"></input><input type="%upvar"></input><input type="%s"></input></inputs><script><block s="doDeclareVariables"><list><l>return_val</l></list></block><block s="doSetVar"><l>return_val</l><block s="reportNewList"><list></list></block></block><custom-block s="for %upvar in %s %cs"><l>i</l><block var="iterable"/><script><block s="doSetVar"><l>out</l><block var="i"/></block><block s="doAddToList"><block s="evaluate"><block var="expr"/><list></list></block><block var="return_val"/></block></script></custom-block><block s="doReport"><block var="return_val"/></block></script></block-definition></blocks><variables></variables></project>

What's wrong?

You need to rename the upvars in the definition of the for-in stack block: second one to "char" and third one to "item" due to the glitch pointed out above.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6577 2013-01-17 10:29:28

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

Re: BYOB 3 - Discussion Thread

Thanks, Hardmath123, I'm investigating this right now.


Jens Mönig

Offline

 

#6578 2013-01-17 10:58:16

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

Re: BYOB 3 - Discussion Thread

Hi, Hardmath123,

I'm afraid I don't quite understand your problem. I can rename upvars, both in block instances in the scripting area and inside other block definitions, save the project, load it, and the changed upvar names are still there.

There is a known problem about upvars: When you edit the definition of a block containing an upvar, and then press CANCEL, the upvar reverts to its default name. Is this the problem you've noticed?

Thanks!

also feel free to directly e-mail me, since I'm not constantly monitoring the forums anymore  smile

Last edited by Jens (2013-01-17 10:59:31)


Jens Mönig

Offline

 

#6579 2013-01-17 12:58:56

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

For lambda, I modestly recommend my own book Simply Scheme.

Is there a PDF / Kindle version of the whole book somewhere? I couldn't find one...


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#6580 2013-01-17 14:05:23

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

bharvey wrote:

For lambda, I modestly recommend my own book Simply Scheme.

Is there a PDF / Kindle version of the whole book somewhere? I couldn't find one...

I've just been downloading every chapter's PDF onto my Kindle as I go.  tongue


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#6581 2013-01-17 14:08:52

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

Re: BYOB 3 - Discussion Thread

Hi Hardmath123,

I've changed the way edited blocks update their instances. Now, changes to edited blocks only become propagated to all instances upon pressing either OK or ACCEPT in the block editor (also resetting any renamed upvars in instances back to their default names). Merely looking at a definition and then pressing CANCEL no longer changes anything.

(you might have to flush your browser's cache to activate this)

I hope to have gotten this right now. Please test away and let me know if you find anything else.

Thanks again for reporting this!

Last edited by Jens (2013-01-17 14:09:54)


Jens Mönig

Offline

 

#6582 2013-01-17 14:46:38

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

How about an (environment []) block that returns whatever the string argument's value is bound to? That way you can test for and call arbitrary variables and functions (like in JS's window.*). Am I missing something here?

The issue isn't one of technical difficulty but of aesthetics, I think.  Once you decide to have users type in the name of a variable, you can just have a block like the one in Panther that has no name and a text box input.

If we were starting the design over completely, by the way, I'd want to explore using a single namespace for procedures and other value types, as Scheme does.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6583 2013-01-17 15:04:47

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

<set () to ()>ing that would set the variable pointed to by that variable blob (as it does in BYOB 3.x).

The BYOB3 meaning is very powerful, but (experience has shown) it's also really confusing to the users.  If we want to revive that feature, it'll have to be with a different notation, e.g., add another block called SET INDIRECT or something.  (I'm not advocating that; I'd rather find another way that doesn't require indirect setting of variables.)

I thought by uninterned symbol you meant a name for a variable that couldn't otherwise be created, e.g., a name starting with a NUL character.

That's how you usually implement it, but technically there's no reason a symbol has to have a text string associated with it at all.  Especially if the language you're building doesn't privilege text as the way to communicate with it!  smile

But, instead of designing hypothetical features for Snap! 4.3, could you please finish debugging the loading of .YPR projects?  We're really depending on you for this, and it really has to work!  Okay?  Thanks!


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6584 2013-01-17 15:20:40

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Is there a PDF / Kindle version of the whole book somewhere?

Not online.  Does it matter?  You could just concatenate all the chapters.  smile


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6585 2013-01-17 15:39:18

Snowdrift
Scratcher
Registered: 2011-06-22
Posts: 500+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

blob8108 wrote:

Is there a PDF / Kindle version of the whole book somewhere?

Not online.  Does it matter?  You could just concatenate all the chapters.  smile

Hate to be offtopic, but this is the 88000 post in AT  yikes

Offline

 

#6586 2013-01-17 16:15:21

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Snowdrift wrote:

Hate to be offtopic, but this is the 88000 post in AT  yikes

What does that have to do with Lord of the Rings?


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6587 2013-01-17 16:21:24

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Not off topic at all.  Off topic would be, you know, Lord of the Rings.  smile

Wait, what was I thinking???  Rings are totally on topic in this thread!

One ring to rule them all:

http://cs.berkeley.edu/~bh/onering.png


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6588 2013-01-17 16:31:45

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Jens wrote:

Now, changes to edited blocks only become propagated to all instances upon pressing either OK or ACCEPT in the block editor (also resetting any renamed upvars in instances back to their default names).

That's still not the correct behavior. Renamed upvars should keep their names, just like other input slots.

@Brian I'm working on it. I even starred your email.

Last edited by nXIII (2013-01-17 18:56:31)


nXIII

Offline

 

#6589 2013-01-17 17:30:05

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

bharvey wrote:

Not off topic at all.  Off topic would be, you know, Lord of the Rings.  smile

Wait, what was I thinking???  Rings are totally on topic in this thread!

One ring to rule them all:

http://cs.berkeley.edu/~bh/onering.png

tongue


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#6590 2013-01-17 18:56:41

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

There. Fixed. Back to Snap! 4.3.


nXIII

Offline

 

#6591 2013-01-17 20:10:09

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

bharvey wrote:

Not off topic at all.  Off topic would be, you know, Lord of the Rings.  smile

Wait, what was I thinking???  Rings are totally on topic in this thread!

One ring to rule them all:

http://cs.berkeley.edu/~bh/onering.png

lol
EDIT: In my sig now: LOTR updates can be specific to this thread (page 182  big_smile ).  tongue

@Jens: Yes, the problem did appear to happen whenever I clicked cancel (though I didn't make the connection then!). I'll try it out now.  smile

Last edited by Hardmath123 (2013-01-17 20:14:47)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6592 2013-01-17 20:21:18

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

@Jens, now it's reverting to defaults when I press OK after a change… Also, for some reason, the second scriptlet I wrote in the project posted above seems to indicate that Snap tries to cast the value to a number or something. "1abc" becomes 1 while "abc" becomes "abc". Also, empty string becomes 0.  hmm


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6593 2013-01-17 21:53:27

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Also, empty string becomes 0.

Huh.  This happened to me this afternoon and I thought I must have done it myself accidentally.  Good to know it wasn't my fault.  smile


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6594 2013-01-18 07:11:32

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

Re: BYOB 3 - Discussion Thread

Okay, these issues should (I hope) be fixed now. Again flush your caches and test away!


Jens Mönig

Offline

 

#6595 2013-01-18 07:39:18

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hmm, the one above

… Also, for some reason, the second scriptlet I wrote in the project posted above seems to indicate that Snap tries to cast the value to a number or something. "1abc" becomes 1 while "abc" becomes "abc". Also, empty string becomes 0.

is still broken.

XML File: http://tinyurl.com/snaptestiteration1


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6596 2013-01-18 08:29:58

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

Re: BYOB 3 - Discussion Thread

Ah, indeed a typecasting error (I hate it when JavaScript does that). Now let me find it...


Jens Mönig

Offline

 

#6597 2013-01-18 08:43:18

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

Re: BYOB 3 - Discussion Thread

Okay, here is the thing: When setting a variable, if the value can be interpreted as a number (e.g. if it is a string beginning with a number), Snap will cast it to one. Numbers take precedence over strings. In your example you can prevent this from happening by adding an alphabetical character at the beginning of the word.


Jens Mönig

Offline

 

#6598 2013-01-18 10:04:18

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Ah. But isn't that a bug? Clearly what I was trying to do was completely valid and so should be possible without that insider info.

Anyway, I think under the hood if you do something like ""+... should give a string.

P.S. Any chance you'll add the iter function in the tools? Ever since I wrote a Python raytracer, I can't imagine good code without iterating over stuff like that! Seriously, it's like

Code:

for (var i=0; i<list.length; i++) {
 alert(list[i]);
}

vs.

Code:

for i in list:
 print i

EDIT: Maybe I'll write a JS library to do stuff like that:

Code:

ITER([1,2,3,4,5,6,7,8,9,10], function(num) {
  alert(num*3);
});

Shouldn't be too hard.

Last edited by Hardmath123 (2013-01-18 10:06:41)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6599 2013-01-18 11:11:24

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Code:

for i in list:
 print i

http://cs.berkeley.edu/~bh/foreach.png

(Channeling Jens: "Clear your cache.")

PS I agree with you about the number thing.  That was Scratch
trying too hard never to give an error message.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6600 2013-01-18 11:14:43

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

That's in tools? Sweet. Though it should accept numbers, strings, and objects, too.

EDIT: Ooh, recursion!  big_smile

Last edited by Hardmath123 (2013-01-18 11:33:07)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

Board footer