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

#6551 2013-01-15 16:40:50

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

OldCodger wrote:

This fact disqualifies Lisp from being a functional language.

It certainly disqualifies Lisp from being a purely functional language, yes.

But, you know, Haskell was invented in 1990, 40 years after the functional programming style was invented in Lisp.  I really don't want to have to defend Lisp.

Nor should you defend Lisp because it has proved itself over and over again. The study of programming languages is an interesting and rewarding one. The divergence in AI languages is interesting: Lisp in the USA and Prolog in Europe. For a while it seemed that Prolog was dead but it has made a comeback in Constraint Logic languages.

I mentioned that the first language I learned was Forth. Forth, and stack languages generally are also functional in style. Some might like to check out Factor which, although it's appearance is a little hard to get used to is a very interesting language. Some of the ideas in Factor might translate into Snap!

Offline

 

#6552 2013-01-15 19:35:38

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

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

Sorry for being off-topic, but are there any good resources for reading up on computer science concepts? I'm still a bit confused about lambda and OOP in general. Thanks.  smile

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

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

OOP is a little trickier because there are a lot of different opinions about what it means.  See if you can find the Smalltalk issue of Byte magazine in a library or online somewhere.  Read chapter 3 of SICP.  Read the OOP chapter in the BYOB manual!  smile

Read Gödel, Escher, Bach.


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

Offline

 

#6553 2013-01-15 19:38:37

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

in order to support macros we'll probably need a quasiquote block (and unquote, and unquote-splicing, of course).

Yeah.  Not hard to implement, but it'll take some care to work out what quotation means in a blocks language, let alone backquote.


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

Offline

 

#6554 2013-01-15 20:19:49

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

Re: BYOB 3 - Discussion Thread

@bharvey Awesome, thanks.  big_smile


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

Offline

 

#6555 2013-01-15 20:22:42

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Off topic would be, you know, Lord of the Rings.  smile

And who started that discussion?  tongue


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

Offline

 

#6556 2013-01-15 22:39:16

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

technoboy10 wrote:

Sorry for being off-topic, but are there any good resources for reading up on computer science concepts? I'm still a bit confused about lambda and OOP in general. Thanks.  smile

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

Read Gödel, Escher, Bach.

This is a great book!

Checkout YouTube too. Just search for lambda.

Offline

 

#6557 2013-01-16 02:39:16

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Read Gödel, Escher, Bach.

Isn't that about consciousness...? (I received a copy for Christmas. It's huge!)


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

Offline

 

#6558 2013-01-16 09:23:31

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

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

bharvey wrote:

Read Gödel, Escher, Bach.

Isn't that about consciousness...?

It's about recursive function theory.  Among other things.  smile


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

Offline

 

#6559 2013-01-16 12:45:51

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

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

bharvey wrote:

Read Gödel, Escher, Bach.

Isn't that about consciousness...? (I received a copy for Christmas. It's huge!)

Nah, it's medium-size.  LOTR is huge.


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

Offline

 

#6560 2013-01-16 12:46:51

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

And who started that discussion?

Some kid put something about it in his sig.  tongue


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

Offline

 

#6561 2013-01-16 13:33:33

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

in order to support macros we'll probably need a quasiquote block (and unquote, and unquote-splicing, of course).

And a gensym block as well.


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

 

#6562 2013-01-16 13:52:50

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

And a gensym block as well.

Gensym is easy.  Right now we can do

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

What we need is a DEFINE block to define blocks under program control, like this:

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

EDIT:  Better yet:

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

Last edited by bharvey (2013-01-16 17:20:49)


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

Offline

 

#6563 2013-01-16 14:08:45

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

blob8108 wrote:

bharvey wrote:

Read Gödel, Escher, Bach.

Isn't that about consciousness...? (I received a copy for Christmas. It's huge!)

Nah, it's medium-size.  LOTR is huge.

Especially in terms of reading time.
@Hardmath123 Do you have a LOTR all-three-in-one type book?

Last edited by technoboy10 (2013-01-16 14:10:13)


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

Offline

 

#6564 2013-01-16 17:39:46

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

joefarebrother wrote:

And a gensym block as well.

Gensym is easy.  Right now we can do

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

That's only half of it—you're not verifying that the name isn't already defined.

What we need is a DEFINE block to define blocks under program control, like this:

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

How would you call the block you'd defined?

EDIT:  Better yet:

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

What would the empty inputs do?

Last edited by nXIII (2013-01-16 17:45:27)


nXIII

Offline

 

#6565 2013-01-16 17:41:11

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

How would you call the block you'd defined?

It'd be added to the palette!

What would the empty inputs do?

Sorry, I uploaded the wrong picture.  Read the message again.

How would you define inputs between block labels?

Geez, I dunno, "move %n steps"?  When the time comes, Jens will invent something wonderful.

Last edited by bharvey (2013-01-16 17:57:32)


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

Offline

 

#6566 2013-01-16 17:46:22

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

nXIII wrote:

How would you call the block you'd defined?

It'd be added to the palette!

So there would be no way to use it later in the same run (without hot-swapping it in)?

What would the empty inputs do?

Sorry, I uploaded the wrong picture.  Read the message again.

Ah. How would you define inputs between block labels?


nXIII

Offline

 

#6567 2013-01-16 18:04:29

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

Re: BYOB 3 - Discussion Thread

Hmm.  This "edit" feature is really getting our conversation confusingly out of order.  smile

nXIII wrote:

So there would be no way to use it later in the same run (without hot-swapping it in)?

The deep question here is about whether there are limits to the self-reflection capability of visual programming.  It already comes up with variables, let alone blocks.  Do we need the ability to type text into the pulldown in SET?

In Berkeley Logo I compromised on your specific question, reparsing at the next command line after a dynamic procedure definition, so you could use it in the same run but not on the same line.


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

Offline

 

#6568 2013-01-16 18:20:22

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

That's only half of it—you're not verifying that the name isn't already defined.

Oops I missed this piece.

Yes, I guess so, although in Logo I just refrained from making non-gensym names of the form Gnnnnn.  You want us to make noninterned symbols?  Or you want us to have a DEFINED? predicate and skip over ones that are in use?


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

Offline

 

#6569 2013-01-16 18:23:24

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

In Berkeley Logo I compromised on your specific question, reparsing at the next command line after a dynamic procedure definition, so you could use it in the same run but not on the same line.

The problem is that there's no such thing as an "interactive shell" in a block-based language (the closest you can come is just assembling a script, running it once, and disassembling it). I suppose there's nothing wrong with having blocks which should only be run while making programs rather than executing them…

The deep question here is about whether there are limits to the self-reflection capability of visual programming.  It already comes up with variables, let alone blocks.  Do we need the ability to type text into the pulldown in SET?

I think the problem is that we have no way of putting together blocks in our code—we can only make static lambdas. If we could, e.g., dynamically create a variable reporter blob at runtime, we could pass that into <set () to ()> and it would work perfectly. The same goes for running blocks, and even defining them: we need a way of assembling blocks from their labels and arguments, and scripts from their blocks.

Yes, I guess so, although in Logo I just refrained from making non-gensym names of the form Gnnnnn.  You want us to make noninterned symbols?  Or you want us to have a DEFINED? predicate and skip over ones that are in use?

I was writing a response, but I realized that (I think) we could just return a quoted local variable block (the name doesn't matter). That way, the variable is guaranteed to be unique and (once reporter-<set () to ()> works) we can both get and set it. For example:

http://i50.tinypic.com/2cckkrd.jpg

Last edited by nXIII (2013-01-16 18:31:07)


nXIII

Offline

 

#6570 2013-01-16 18:43:09

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

The problem is that there's no such thing as an "interactive shell" in a block-based language (the closest you can come is just assembling a script, running it once, and disassembling it). I suppose there's nothing wrong with having blocks which should only be run while making programs rather than executing them…

No, no, in Berkeley Logo you could say DEFINE inside a procedure, and you could use the just-defined procedure on the next line of the running procedure.

I think the problem is that we have no way of putting together blocks in our code—we can only make static lambdas. If we could, e.g., dynamically create a variable reporter blob at runtime, we could pass that into <set () to ()> and it would work perfectly. The same goes for running blocks, and even defining them: we need a way of assembling blocks from their labels and arguments, and scripts from their blocks.

I agree that we need to be able to convert between scripts and (deep) lists of blocks.  The open question (to which I hope the answer is no) is whether we also need to convert between individual blocks and character strings.

But your sentence starting "If..." may not be right.  We used to have the feature of dragging a variable blob onto SET but it didn't mean to set that variable, which is what everyone expected it to mean.  It meant "look at the value of the variable in the blob, and use that as the name of the variable to set."  So everyone got burned by that, and we disabled dropping blobs onto SET.

I was writing a response, but I realized that[...]

Yeah, that's the uninterned symbol solution.


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

Offline

 

#6571 2013-01-16 19:31:18

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

But your sentence starting "If..." may not be right.  We used to have the feature of dragging a variable blob onto SET but it didn't mean to set that variable, which is what everyone expected it to mean.  It meant "look at the value of the variable in the blob, and use that as the name of the variable to set."  So everyone got burned by that, and we disabled dropping blobs onto SET.

Sorry, that was a little confusing. I meant one could create a variable blob at runtime and return that. Whatever you put in the first slot of the <set () to ()> block would be evaluated normally and return the variable blob it got from gensym; <set () to ()>ing that would set the variable pointed to by that variable blob (as it does in BYOB 3.x).

Yeah, that's the uninterned symbol solution.

Oh, OK. 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.

Last edited by nXIII (2013-01-16 19:32:40)


nXIII

Offline

 

#6572 2013-01-16 20:24:26

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

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

bharvey wrote:

blob8108 wrote:


Isn't that about consciousness...? (I received a copy for Christmas. It's huge!)

Nah, it's medium-size.  LOTR is huge.

Especially in terms of reading time.
@Hardmath123 Do you have a LOTR all-three-in-one type book?

Yeah.

I've already used it to coin a new word: emathom (rhymes with fathom). Can you guess what it means?

@bharvey: 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?


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

Offline

 

#6573 2013-01-16 20:39:59

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

@bharvey: 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?

That's not what window does. Window is (in the context of a browser) a synonym for the global object (1, eval)('this'). Accessing its properties allows access to global variables. Unless I'm misunderstanding you, <environment ()> would allow access to local variables in the lexical scope of its caller, more akin to eval('typeof name == "undefined" ? undefined : name').

More on-topic, I would love to be able to construct blocks from their labels/inputs/shapes/categories, and with that ability we wouldn't really need any additional facility for variable variables.

EDIT: How about this: We have a block getter <block () () …>. The first and second inputs would look just like Brian's slots above:
http://cs.berkeley.edu/~bh/gensym3.png
The rest of the inputs would be of type any, but they would have a plus-sign editor instead of add/subtract buttons. Clicking a plus sign would bring up an input editor dialog, but instead of inserting slots and labels, it would insert any-type arguments with constant values for labels, and reporters of the form <() input = ()>, <() input list>, or <upvar> (three new operators blocks that construct input slots; the first argument to the first two is a dropdown with Number, Object, etc.) for inputs. You could drag string reporters for variable labels, and slot reporters for variable slots. You could also drag a list into the <block () () …> block containing the parts of the target block, and it would change into a <block () () with parts ()> block.

The <block () () …> block would return a closure in the sprite/stage's global scope wrapping the block described by its arguments. If the category were Variables and the shape were Reporter, it would return a closure in the local scope wrapping the variable blob.

We could also include in the tool package a block that took a list of lists, each describing a block and its arguments, and evaluated it as a script, e.g., [[<set () to ()>, foo, 1], [<say ()>, [<foo>]]]. This could just be implemented using <call ()>/<run ()>

You could use <set () to ()> with a <block () () …> block in the first slot and a closure in the second to define or redefine a block (however, if the block were a variable reporter, it would set the variable, not the block), and you could <call ()> or <run ()> it to evaluate it.

Sorry if that's a bit confusing—mockups coming soon  tongue
Also, I'm aware of all the special-casing for variables, but it's kind of required because variable blobs don't even follow the normal convention of one block for one function, i.e., there are multiple variable blocks that all perform the same function—getting a variable.

Last edited by nXIII (2013-01-16 21:09:27)


nXIII

Offline

 

#6574 2013-01-17 05:44:33

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

Re: BYOB 3 - Discussion Thread

Remember when I suggested a dictionary data type (and then created it within Snap!)? I think you should rethink that a bit further. The main idea is that it will make a lot of (unrelated) things a lot easier. For example, it would be nice to have JSON compatibility to parse JSON into a dictionary and dump a dictionary (or any other Snap!pable data type) into a JSON string. Then, with just the current blocks, I can imagine writing an online block library which Snap! connects to with the url get block and reads off of with JSON.

Also, it would be nice to have a global dictionary reporter called (environment) which you can read and write.

Adding dictionaries is only a matter of a few blocks:

(dictionary [key] [value] >) //where expanding with the arrow adds another pair of inputs, should be right under the list constructor
(value of [] in {}) // {} denotes a dictionary input for now
(key [] exists in {}) // I suppose you could cleverly add this into the above block, maybe by returning empty string
[set [] of {} to []] // creates a new key if needed
(all keys of {}) // for iteration

(parse JSON [])
(stringify JSON [])

I could actually implement this myself, but I'm sure Jens is pretty busy and can't bother to read (wade through) my code (I don't blame him!). Anyway, I think something to consider.


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

Offline

 

#6575 2013-01-17 09:56:52

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

Re: BYOB 3 - Discussion Thread

LETHAL BUG: Customly renamed upvar names in scripts aren't stored properly, so loading an XML snap file with upvar blocks revert to the default name. This totally wreck scripts that use upvars.


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

Offline

 

Board footer