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

#2051 2010-10-25 16:13:02

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Jens wrote:

Code:

#(foo bar baz) do: [ :selector | 
    someObject perform: selector ]

That's still a lambda with a formal parameter (selector)!

I wish there were a \mapsto symbol in ASCII (looks sort of like this:  |-> a right arrow with a vertical bar at its tail), which is the correct symbol for putting formal parameters before an expression to make a function.  Then I'd have understood it the first time.  smile

You're right. Here (not ASCII, I know, but Unicode is better anyway  smile [/blocks]): ↦

I'm assuming you mean something like: a, b ↦ a^2 + ab

Last edited by nXIII (2010-10-25 16:13:56)


nXIII

Offline

 

#2052 2010-10-25 18:44:08

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Unicode is better anyway

Yah, except that the world's programming languages, such as for example Smalltalk, are designed in ASCII, so no mapsto character in lambda expressions (and no lambda, while I'm complaining  smile  ).


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

Offline

 

#2053 2010-10-25 19:39:36

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

nXIII wrote:

Unicode is better anyway

Yah, except that the world's programming languages, such as for example Smalltalk, are designed in ASCII, so no mapsto character in lambda expressions (and no lambda, while I'm complaining  smile  ).

Ah. Very true  smile


nXIII

Offline

 

#2054 2010-10-27 08:18:52

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: BYOB 3 - Discussion Thread

How did you code the C block that fits into strings? Or, did you?

The BBC code is broken down.
:mad:
[color=red]Red color[/color]

Last edited by zorket (2010-10-27 08:20:50)


Marzipan11 must learn to not spoil

Offline

 

#2055 2010-10-27 15:29:39

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

Re: BYOB 3 - Discussion Thread

zorket wrote:

How did you code the C block that fits into strings? Or, did you?

Well, what I did--in my not-quite-finished (haha, not quite...) quest to recreate closures--was create a subclass of ReporterBlockMorph and do a bit of copy-paste-edit from CBlockMorph for nested blocks. You next need to edit the blockAttachPoints: method so that it will allow dropping of command blocks inside a block argument. Some special-form methods in ScratchProcess plus (maybe) a new class and some edits to UpdatingStringMorph (for display purposes) and a new class for scoping (okay, this might be going a bit too far) will get you closures. Then another special-form block (and maybe a new MultiArgMorph like Jens's) "CALL" will give you evaluation OF the closures. I think that's about it. (did I miss anything, Jens?)


nXIII

Offline

 

#2056 2010-10-27 16:28:34

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: BYOB 3 - Discussion Thread

That gave me an idea! I'm getting a little smart at this. I've figured out something new, but the only thing I have really figured out was to make all C blocks fit into strings. Discuss more situations here.
Answer:

add this code in scratchBlocks > CBlockMorph > all > add a code:

Code:

isReporter
^ true

THANK YOU!!!

Last edited by zorket (2010-10-27 16:49:11)


Marzipan11 must learn to not spoil

Offline

 

#2057 2010-10-27 17:12:52

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

Re: BYOB 3 - Discussion Thread

zorket wrote:

That gave me an idea! I'm getting a little smart at this. I've figured out something new, but the only thing I have really figured out was to make all C blocks fit into strings. Discuss more situations here.
Answer:

add this code in scratchBlocks > CBlockMorph > all > add a code:

Code:

isReporter
^ true

THANK YOU!!!

Glad I could help  smile
Good luck!  big_smile


nXIII

Offline

 

#2058 2010-10-28 15:28:33

mortrop
Scratcher
Registered: 2010-10-27
Posts: 100+

Re: BYOB 3 - Discussion Thread

What is BYOB3?


http://i1244.photobucket.com/albums/gg572/BLU_Spy/Confused.png?t=1343070475http://1.bp.blogspot.com/-gGakFCKTYWY/TvPBuHF7T2I/AAAAAAAAAN8/Ypk5vwKdvys/s1600/happy-holidays.jpg

Offline

 

#2059 2010-10-28 16:20:29

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

mortrop wrote:

What is BYOB3?

Wow. Just Wow.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#2060 2010-10-28 21:15:10

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

Re: BYOB 3 - Discussion Thread

mortrop wrote:

What is BYOB3?

Here, watch this.


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

Offline

 

#2061 2010-10-28 21:26:53

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

mortrop wrote:

What is BYOB3?

BYOB is a programming language based off of Scratch that adds support for custom blocks, first-class lists, and first-class scripts. At its heart, BYOB lets you put blocks into other blocks, which show up in the blocks palette:

Creating a new block is really simple. Right-click the scripts area and choose "Create a block". You can give the block a name and then snap blocks into the custom block area.
http://i302.photobucket.com/albums/nn100/fullmoon32/basic-block.gif
You can also allow your block to take inputs. For instance, the "say" block takes one input, a string of text, and then displays it in a speech bubble. When in the block editor, you can mouse over the custom block's name. You'll see some plus signs in between words, which you can click to add an input there. There are various types of inputs, so if you're not sure it's never a bad idea to chose "any":
http://i302.photobucket.com/albums/nn100/fullmoon32/inputs-example.jpg
This creates a reporter block that you can use just like any other:
http://i302.photobucket.com/albums/nn100/fullmoon32/block-params.gif
Blocks can also report values. Here is an exponent block that takes two integers and then reports a calculation that happens between them:
http://i302.photobucket.com/albums/nn100/fullmoon32/block-with-report.gif
You will also quickly notice the "the script" and "the block" blocks. These blocks are both reporters that report the script inside of them! This means you can assign a script to a variable, or add it as an index of a list. You can then "run" or "launch" a script or "call" a block. Running a script will wait for it finish executing...
http://i302.photobucket.com/albums/nn100/fullmoon32/lambda-example.gif
...but launching won't:
http://i302.photobucket.com/albums/nn100/fullmoon32/launch-example.gif
Because BYOB's scripts and blocks can be assigned to a variable, passed to a block, and returned from a function, they are first-class scripts. In addition to taking inputs, scripts built with the "the script" block can also report values just like custom blocks:
http://i302.photobucket.com/albums/nn100/fullmoon32/lambda-call.gif

Notice the little arrows on the end of "the script" and "the block". Clicking these will add input variables to these first-class scripts. You can click an input variable to change its name.  The "run", "launch", and "call" blocks all have little arrows on them. By clicking those, you can add slots to the block that will pass their contents to whatever is being run, launched, or called.

You'll have noticed the "script variables" block -- it simply creates variables that are local to the current script. This should go at the top of every script to make sure its variables are usable.

Besides first-class scripts, BYOB also adds first-class lists to the mix. In BYOB, you'll see a (list) reporter with an arrow that lets you add items to it. This will report a list just like any you might create with the "Make a list" button.
http://i302.photobucket.com/albums/nn100/fullmoon32/list-call-example.gif
You can add first-class lists to anything, even other lists.
http://i302.photobucket.com/albums/nn100/fullmoon32/list-of-lists.gif
Custom blocks can have special input slots that only accept lists:
http://i302.photobucket.com/albums/nn100/fullmoon32/list-example.gif

After a while, you'll get the hang of BYOB and you can make something cool like this:
http://i302.photobucket.com/albums/nn100/fullmoon32/random-math-fact.gif
If you understand that, you understand most of what BYOB is about! There's so much you can do with it beyond the obvious, so check out the BYOB3 page for examples, tutorials, etc. Happy BYOBing!

Last edited by fullmoon (2010-10-30 19:35:14)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2062 2010-10-28 22:45:52

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

Re: BYOB 3 - Discussion Thread

Wow fullmoon! That should be the default "What is BYOB3?" answer!  big_smile

@henley: He/she is a new Scratcher. It's cool that he/she is interested in BYOB3!

Offline

 

#2063 2010-10-28 22:47:53

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

Wow fullmoon! That should be the default "What is BYOB3?" answer!  big_smile

@henley: He/she is a new Scratcher. It's cool that he/she is interested in BYOB3!

I...sort of accidentally wrote all that. Wow. I just felt I couldn't explain one part without explaining the rest.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2064 2010-10-28 23:27:25

JTxt
Scratcher
Registered: 2010-05-19
Posts: 100+

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

I...sort of accidentally wrote all that. Wow. I just felt I couldn't explain one part without explaining the rest.

Awesome accident!  I need to play with BYOB more.

Last edited by JTxt (2010-10-28 23:30:52)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#2065 2010-10-29 00:39:31

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

BYOB is a programming language based off of Scratch...

Wow!  (This thread seems to be provoking a lot of "wow"s.  smile  )  Thanks for taking the time to write all that, and also for caring enough about BYOB.

One teeny little infelicitous turn of phrase -- I'm pretty sure that you actually understand it correctly, but you put this in an ambiguous way:

When a script or a block can be assigned to a variable, it's called a first-class script.

This makes it sound as if some scripts are first class and others aren't.  First classness is a property of a data type, not of a particular instance of that type.  In BYOB, scripts and blocks are first class.  That means that scripts and blocks in general can be the value of a variable, an input to a block, reported by a block, or a member of a list, even if a particular project doesn't use a particular script or block in those ways.


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

Offline

 

#2066 2010-10-29 01:21:35

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

Re: BYOB 3 - Discussion Thread

My jaw just dropped to the floor, fullmoon! This is such a definitive epic explanation that I'm reluctant to post anything after it, besides that I totally love it. Thanks!


Jens Mönig

Offline

 

#2067 2010-10-29 08:00:06

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

One teeny little infelicitous turn of phrase -- I'm pretty sure that you actually understand it correctly, but you put this in an ambiguous way:

When a script or a block can be assigned to a variable, it's called a first-class script.

You're right, this is a little ambiguous. I was referring to the data type in general, but I didn't say so very well.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2068 2010-10-29 13:44:36

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

Re: BYOB 3 - Discussion Thread

Jens wrote:

My jaw just dropped to the floor, fullmoon! This is such a definitive epic explanation that I'm reluctant to post anything after it, besides that I totally love it. Thanks!

I fully agree with your comment,Jens, fullmoon is really a Byob Master ! Respect !

Offline

 

#2069 2010-10-30 19:07:37

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

so check out the BYOB3 page for examples, tutorials, etc.

I'm sorry to be so fussy, fullmoon, but this link doesn't work.  "Berkeley" has only one "l". (Gotta learn how to spell it if you're going to be a student here.  smile  )

P.S.  Check out this suggestion in the suggestions forum inspired by your post.  big_smile

Last edited by bharvey (2010-10-30 19:11:32)


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

Offline

 

#2070 2010-10-30 19:33:49

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

fullmoon wrote:

so check out the BYOB3 page for examples, tutorials, etc.

I'm sorry to be so fussy, fullmoon, but this link doesn't work.  "Berkeley" has only one "l". (Gotta learn how to spell it if you're going to be a student here.  smile  )

P.S.  Check out this suggestion in the suggestions forum inspired by your post.  big_smile

Thanks for catching that! What a stupid typo...I don't even think it's possible to pronounce "Berkelely". Surely part of the application screening process at Berkeley is making sure that potential students spelled it right.  big_smile

Maybe in the name of competitiveness you should rename your school to something that's impossible to spell wrong, like MIT.  wink


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2071 2010-10-30 19:34:56

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Also, I am extremely honored to have inspired that Scratch Suggestion. I really like the idea!


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2072 2010-10-30 21:18:07

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

I don't even think it's possible to pronounce "Berkelely".

Sure.  "Berk-luh-lee."  smile   But at least we're not called "Leland Stanford Junior University," the paradigmatic ambiguously parsed phrase.


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

Offline

 

#2073 2010-10-30 21:22:45

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: BYOB 3 - Discussion Thread

You know? I've been using BYOB for a long time, and I'm really good with it, but I still don't understand what makes something first class.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#2074 2010-10-30 21:33:25

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

Re: BYOB 3 - Discussion Thread

I have to say, Scratch Suggestions has really frustrated me.
The chronic theme of the site certainly isn't programming.

It seems like people want Scratch to evolve in to a YouTube-type website. It's frustrating. Scratch seems to be slipping away from the emphasis on programming it once had. This isn't the first time I've observed this, but it has become more and more noticeable as time progressed. It seems as if it can only get worse.

I think the Scratch program is awesome, but I'm sick of seeing the "high ceiling" continuously slip lower. That's why I'm turning to BYOB3. Jens and bharvey, don't let me down!  big_smile

Offline

 

#2075 2010-10-30 21:57:47

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

Re: BYOB 3 - Discussion Thread

ScratchReallyROCKS wrote:

You know? I've been using BYOB for a long time, and I'm really good with it, but I still don't understand what makes something first class.

Okay, first, let's reiterate the official definition:  A data type is first class in a language if an instance of that type can be

* the value of a variable;

* an input to a procedure (Scratch: block);

* the value returned (Scratch: reported) by a procedure;

* an element of a data aggregate (Scratch: list).

So now, as an example, let's look at lists.  In Scratch, make a list.  You have to give it a name, let's say FOO.  Now put some items into FOO, like ABC and DEF and 23.  Now make a variable, ZOT, and run the block SET <ZOT> TO <FOO> (dragging the red FOO oval into the SET block).  The new value of ZOT will not be a list of three items ABC, DEF, and 23; instead, it'll be the string "ABC DEF 23".  Scratch doesn't let a list be the value of a variable.

Now do the same thing in BYOB.  This time, the value of ZOT will actually be the list FOO!  You can see it in the monitor that displays ZOT on the stage.  Thus we see that a list can be the value of a variable.

Similarly, in BYOB you can make a block that takes a list as input, and/or reports a list.  (Of course in Scratch you can't make blocks at all, but it's worth noting that none of the built-in blocks take lists as inputs or report a list.)  And you can use a list as an item in another list.

Another point that I've seen in some books as part of the definition of first class, but not others, is that the data can exist without having a name.  In Scratch, you click Make a list, and the first thing that happens is that you're asked what to name it.  You can do that in BYOB, too, if you want, but you can also use the LIST block to make a list by saying what its contents should be, but not giving it a name, e.g., [SAY [LIST <1> <2> <3>]].  You create a list and use it as input to the SAY block, and it never has a name.

So this is why we say that lists are first class in BYOB but not in Scratch.  (The data types that are first class in Scratch are just numbers and text strings.  Booleans would be included, too, but in Scratch there really isn't a separate Boolean type; instead sometimes they use the text strings "true" and "false" and sometimes they use the numbers 1 and 0 respectively.)

The other data type that's first class in BYOB but not in Scratch is procedures (blocks and scripts).  But this post is long enough already.  smile


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

Offline

 

Board footer