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

#5426 2012-06-09 18:46:35

OldCodger
New Scratcher
Registered: 2012-05-16
Posts: 54

Re: BYOB 3 - Discussion Thread

bharvey wrote:

OldCodger wrote:

list comprehension

Look at my http://byob.berkeley.edu/streams.ypr]lazy list/url BYOB project to see how we can do this.  The syntax isn't exactly the same, but nothing stops you from making a block

if that notation turns you on.

Lazy lists are very useful but I hate Lisp-speak. I am going to try and build a list comprehension block.

Offline

 

#5427 2012-06-10 04:57:03

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

OldCodger wrote:

list comprehension

Look at my lazy list BYOB project to see how we can do this.  The syntax isn't exactly the same, but nothing stops you from making a block

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

if that notation turns you on.

i don't understand that notation. Could you explain it or make a more readable notation?


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#5428 2012-06-10 09:31:30

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

i don't understand that notation. Could you explain it or make a more readable notation?

[ (map-function) | (upvar) IN (stream) , (predicate) ]

means

MAP (map-function) OVER (KEEP ITEMS SUCH THAT (predicate) FROM (stream))

but using the stream (lazy list) versions of MAP and KEEP.  So for example

[ ((2) * (x)) | (x) IN (positive-integers) , ((SQRT OF (x)) = (ROUND (SQRT OF (x))) ]

would take the positive integers, select the ones that are squares of integers, and compute 2 * x for each, giving the stream (2, 8, 18, 32, 50, 72, ...).

(That explains the notation, but assumes you understand lazy lists, which allow lists to have infinitely many elements.  If you need help with that, first read the project notes in my project, then ask again.)

Last edited by bharvey (2012-06-10 09:32:42)


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

Offline

 

#5429 2012-06-10 10:19:36

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

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

Is there a Snap! discussion thread?


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

Offline

 

#5430 2012-06-10 10:37:22

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Hardmath123 wrote:

You need a GreaseMonkey userscript:

Good workaround, thanks, but it still needs to be really fixed — I don't think most schools are going to run Greasemonkey!

Well, you could put that directly into the code too.

Offline

 

#5431 2012-06-10 10:40:42

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

technoboy10 wrote:

Is there a Snap! discussion thread?

We're just using this, until Snap! is released/goes into beta.

Offline

 

#5432 2012-06-10 10:43:22

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

Re: BYOB 3 - Discussion Thread

scimonster wrote:

technoboy10 wrote:

technoboy10 wrote:

Is there a Snap! discussion thread?

We're just using this, until Snap! is released/goes into beta.

Okay.


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

Offline

 

#5433 2012-06-10 10:44:52

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

Re: BYOB 3 - Discussion Thread

Does Snap! alpha look weird on Firefox for anyone else (Windows 7)?


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

Offline

 

#5434 2012-06-10 14:13:41

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

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

Does Snap! alpha look weird on Firefox for anyone else (Windows 7)?

Can you post a screenshot showing what looks weird? Thanks!


Jens Mönig

Offline

 

#5435 2012-06-10 14:36:43

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

joefarebrother wrote:

i don't understand that notation. Could you explain it or make a more readable notation?

[ (map-function) | (upvar) IN (stream) , (predicate) ]

means

MAP (map-function) OVER (KEEP ITEMS SUCH THAT (predicate) FROM (stream))

but using the stream (lazy list) versions of MAP and KEEP.  So for example

[ ((2) * (x)) | (x) IN (positive-integers) , ((SQRT OF (x)) = (ROUND (SQRT OF (x))) ]

would take the positive integers, select the ones that are squares of integers, and compute 2 * x for each, giving the stream (2, 8, 18, 32, 50, 72, ...).

(That explains the notation, but assumes you understand lazy lists, which allow lists to have infinitely many elements.  If you need help with that, first read the project notes in my project, then ask again.)

So it is a composition of (strm-map (func)(strm)) and (strm-filter (pred)(strm))

Last edited by joefarebrother (2012-06-11 13:35:02)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#5436 2012-06-10 17:24:22

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

So it is a composition of (strm-map (pred)(strm)) and (strm-filter (pred)(strm))

Yes, exactly, except that "pred" applies only to filter, not map.  (Predicate functions are the ones that return Boolean values.)


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

Offline

 

#5437 2012-06-10 19:16:11

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

Re: BYOB 3 - Discussion Thread

Jens wrote:

technoboy10 wrote:

Does Snap! alpha look weird on Firefox for anyone else (Windows 7)?

Can you post a screenshot showing what looks weird? Thanks!

Here you go!
http://scratch.mit.edu/static/projects/technoboy10_alt/2601890_sm.png<Clicky

Last edited by technoboy10 (2012-06-10 20:09:32)


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

Offline

 

#5438 2012-06-10 20:04:33

OldCodger
New Scratcher
Registered: 2012-05-16
Posts: 54

Re: BYOB 3 - Discussion Thread

bharvey wrote:

joefarebrother wrote:

i don't understand that notation. Could you explain it or make a more readable notation?

[ (map-function) | (upvar) IN (stream) , (predicate) ]

means

MAP (map-function) OVER (KEEP ITEMS SUCH THAT (predicate) FROM (stream))

but using the stream (lazy list) versions of MAP and KEEP.  So for example

[ ((2) * (x)) | (x) IN (positive-integers) , ((SQRT OF (x)) = (ROUND (SQRT OF (x))) ]

would take the positive integers, select the ones that are squares of integers, and compute 2 * x for each, giving the stream (2, 8, 18, 32, 50, 72, ...).

(That explains the notation, but assumes you understand lazy lists, which allow lists to have infinitely many elements.  If you need help with that, first read the project notes in my project, then ask again.)

You can watch this video by Erik Meijer and read the same chapter in Programming in Haskell by Graham Hutton. They will help you understand list comprehension.

http://channel9.msdn.com/shows/Going+Deep/C9-Lectures-Dr-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-5-of-13/

Offline

 

#5439 2012-06-11 01:26:11

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

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

Jens wrote:

technoboy10 wrote:

Does Snap! alpha look weird on Firefox for anyone else (Windows 7)?

Can you post a screenshot showing what looks weird? Thanks!

Here you go!
http://scratch.mit.edu/static/projects/ … 890_sm.png<Clicky

Thanks for the screenshot! I cannot reproduce these on my computers (Mac and PC), except for the missing Unicode characters (the stop sign) in some browsers. To me it appears that your OS display settings allow for too few colors (it looks like 16 - 256 colors to me). Can you try changing your display settings to allow for more colors? Thanks!


Jens Mönig

Offline

 

#5440 2012-06-11 13:16:58

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: BYOB 3 - Discussion Thread

While I can't say I'm having any trouble with the bluriness technoboy described, I can report that the latest version of Chrome on Windows is missing the stop and go unicode characters (I just thought you hadn't added them yet). Any plans to fix that?

Offline

 

#5441 2012-06-11 13:23:45

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

While I can't say I'm having any trouble with the bluriness technoboy described, I can report that the latest version of Chrome on Windows is missing the stop and go unicode characters (I just thought you hadn't added them yet). Any plans to fix that?

Well, the green and red squares have been replaced (as of today) with the standard green flag and stop sign, so maybe that was the way they fixed that.


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

Offline

 

#5442 2012-06-11 14:28:53

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

Re: BYOB 3 - Discussion Thread

Unfortunately the full Unicode set (or even the most common subset) isn't supported by every browser, especially under Windows, but eventually we're going to replace the problematic font symbols with drawn ones. At the moment, however, this isn't a priority.


Jens Mönig

Offline

 

#5443 2012-06-13 08:51:07

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

i personally prefer it without blur  smile

Offline

 

#5444 2012-06-13 18:08:23

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Posted this thread and realized I probably should have just asked my question here.

Offline

 

#5445 2012-06-13 22:33:42

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

my question

Look up isTouching in morphic.js.


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

Offline

 

#5446 2012-06-14 05:12:09

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@ bharvey & Jens
Don't forget to implement the two Byob  "touching" instructions still missing in Snap!

Offline

 

#5447 2012-06-15 10:58:15

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

Re: BYOB 3 - Discussion Thread

Snap! alpha update

Folks, this week's work on Snap! features among other things:

  * global custom blocks ("for all sprites")
  * optional solid drop shadows and stack highlights (default in Chrome)
  * saving / loading of global variables and stage variables

Enjoy!


Jens Mönig

Offline

 

#5448 2012-06-15 11:06:08

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

Re: BYOB 3 - Discussion Thread

Sweet, new features!


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

Offline

 

#5449 2012-06-15 11:55:32

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Bug: http://img100.imageshack.us/img100/9738/pngb.png returns '1', not '10'.


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#5450 2012-06-15 13:11:54

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

Jens wrote:

Snap! alpha update
Enjoy!

1- Saving/loading of a variable defined as a LIST is reloaded correctly but is not recognized in the executable block. I need to reset it. I shall investigate further on.
2 - I ignore if this is a new feature or not. Anyhow it is new for me.
To duplicate one block from Sprite1 to a newly created Sprite2 :
- duplicate the block and drag it onto the Sprite area.
- close Sprite1 and open Sprite2.
- drag the duplicated block onto the script area of Sprite2
- that's it !

Offline

 

Board footer