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

#4726 2012-03-03 07:43:05

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

Re: BYOB 3 - Discussion Thread

BornAgainAtheist wrote:

Until then, Brian & Jens, would you distribute it if I made a Snap copy of all the functions from BYOB's tool sprite? I'd like to help somehow and unless you need a Python coder or very very green JS coder for something, I don't think I could be any help in the actual coding.

Sure.  As long as you write the list higher order functions using IN FRONT OF (cons) and ALL BUT FIRST ITEM OF (cdr) rather than the imperative-style implementations in the BYOB toolkit.  (Had to be that way in BYOB for efficiency reasons but now efficiency as well as aesthetics requires cons/car/cdr linked list style.

Thanks.


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

Offline

 

#4727 2012-03-03 07:52:31

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Please add these [string operations], they're really helpful:

I agree that we should add the ability to handle text soon.  But I'd like to raise the idea that we should do it Logo-style (words and sentences) rather than Scratch-style (flat strings of text).  Argument for the change: It's a much more natural way to handle natural language text.  When you're reading "the quick brown fox" you don't see a string of 19 characters; you see a sequence of four words.  You don't really see the spaces between words at all, unless you're writing a text-string-based computer program.

Argument against: The functions I want can be written in terms of the Scratch ones, and the latter are at a lower level of abstraction, so writing the former is a good learning opportunity -- the same reason MAP, KEEP, etc. aren't primitives.

At the very least, though, we should make JOIN variadic.


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

Offline

 

#4728 2012-03-03 08:23:15

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Hardmath123 wrote:

Please add these [string operations], they're really helpful:

I agree that we should add the ability to handle text soon.  But I'd like to raise the idea that we should do it Logo-style (words and sentences) rather than Scratch-style (flat strings of text).  Argument for the change: It's a much more natural way to handle natural language text.  When you're reading "the quick brown fox" you don't see a string of 19 characters; you see a sequence of four words.  You don't really see the spaces between words at all, unless you're writing a text-string-based computer program.

Argument against: The functions I want can be written in terms of the Scratch ones, and the latter are at a lower level of abstraction, so writing the former is a good learning opportunity -- the same reason MAP, KEEP, etc. aren't primitives.

At the very least, though, we should make JOIN variadic.

What does variadic mean?

EDIT: Got it—arbitrary number of inputs. I was wondering about what to call that for ages!

Last edited by Hardmath123 (2012-03-03 08:38:01)


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

Offline

 

#4729 2012-03-03 09:40:40

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

I was wondering about what to call that for ages!

CLONE: niladic
SQRT: monadic
MOD: dyadic
LIST: variadic

smile

P.S.  And the name for "the number of inputs this block expects" is its arity (yes, no "p" at the front).

Last edited by bharvey (2012-03-03 09:45:48)


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

Offline

 

#4730 2012-03-03 09:57:44

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Hardmath123 wrote:

I was wondering about what to call that for ages!

CLONE: niladic
SQRT: monadic
MOD: dyadic
LIST: variadic

smile

P.S.  And the name for "the number of inputs this block expects" is its arity (yes, no "p" at the front).

Now I'm curious: how do you express a variatic function in, say, JavaScript? You can probably manage in BYOB with "multiple input"...


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

Offline

 

#4731 2012-03-03 10:17:54

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

how do you express a variatic function in, say, JavaScript?

http://www.switchonthecode.com/tutorial … -functions


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

Offline

 

#4732 2012-03-03 12:53:35

BornAgainAtheist
New Scratcher
Registered: 2012-02-13
Posts: 42

Re: BYOB 3 - Discussion Thread

in the byobs repeat function that has an out var for the cycle, the cycle starts at one is it fine if it starts at zero?

Offline

 

#4733 2012-03-03 16:53:54

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

Re: BYOB 3 - Discussion Thread

@ bharvey & Jens
bharvey says "The other is that all the grey borders disappear.  (Maybe we're doing away with grey borders, in which case we should do away with them soon!"

Grey bordering does not work in the Script Area, but works well into the block editor.
In the first case there is a walk around , use THE...BLOCK. The issue is that one instruction with "grey borders" is much shorter than with "the block" with cases where you need to chain many of such instructions.

Offline

 

#4734 2012-03-03 17:07:08

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

Re: BYOB 3 - Discussion Thread

@ bharvey & Jens
I'm reverting to this issue : if you wa

Offline

 

#4735 2012-03-03 17:12:44

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

Re: BYOB 3 - Discussion Thread

@ bharvey & Jens
I'm reverting to this issue : if you want to use a named variable as a list, you need to first initiate it to a void list (LIST()). IMHO this prevents to write MAP-like functions in a pure recursive style (with the help of ALL BUT FIRST) as it can be seen in the Byob Reference Manuel p14

Offline

 

#4736 2012-03-03 21:51:07

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

Re: BYOB 3 - Discussion Thread

BornAgainAtheist wrote:

in the byobs repeat function that has an out var for the cycle, the cycle starts at one is it fine if it starts at zero?

I know that would feel more computer sciency, but it doesn't mesh well with the fact that list elements are numbered from 1.  And, for non computer scientists, it would feel unnatural, I think.  When you ask "which repetition is this?" you don't mean "how many repetitions were already completed before this one started?"  Starting from 1 means that the cardinality and ordinality match up -- that is, even if you want to call this repetition number 0, you're still going to say it's the first repetition.

P.S.  I am burning with curiosity, but feel free to ignore this if you want: Are you ethnically Chinese?  Here at Berkeley it's always the Chinese(-American) students who say "is it fine?" rather than "is it okay?"


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

Offline

 

#4737 2012-03-03 22:00:46

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

Re: BYOB 3 - Discussion Thread

xly wrote:

this prevents to write MAP-like functions in a pure recursive style (with the help of ALL BUT FIRST)

Eh?

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

What am I missing?


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

Offline

 

#4738 2012-03-04 01:25:51

BornAgainAtheist
New Scratcher
Registered: 2012-02-13
Posts: 42

Re: BYOB 3 - Discussion Thread

bharvey wrote:

P.S.  I am burning with curiosity, but feel free to ignore this if you want: Are you ethnically Chinese?  Here at Berkeley it's always the Chinese(-American) students who say "is it fine?" rather than "is it okay?"

No, but I am 1/64 American Indian, I'm mostly Norwegian. My family has been in America for the whole century at least so there isn't much cultural influence on my speech or word choice, it just varies from sentence to sentence. If that was grammatically incorrect, I'm sorry... can't fix it until I have more posts on my new profile and I was never as up on grammar in school as math and technology (unless its programming 'grammar')  big_smile

Offline

 

#4739 2012-03-04 03:44:14

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

xly wrote:

this prevents to write MAP-like functions in a pure recursive style (with the help of ALL BUT FIRST)

Eh?

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

What am I missing?

Excellent ! You' ll have to change accordingly your MAP example into your Byob tutorial !!!

Offline

 

#4740 2012-03-04 05:22:24

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

Re: BYOB 3 - Discussion Thread

Voila...
http://www.xleroy.net/ByobTuto/New/newmapg.gif

Offline

 

#4741 2012-03-04 08:24:12

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

Re: BYOB 3 - Discussion Thread

BornAgainAtheist wrote:

If that was grammatically incorrect, I'm sorry...

No, not incorrect, just not the fashion of speaking, particularly among young people.  Didn't mean to embarrass you.


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

Offline

 

#4742 2012-03-04 08:31:16

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

Re: BYOB 3 - Discussion Thread

Your MAPG is having trouble deciding whether it wants to be a command (base case) or a reporter (recursive case).   If it REPORTs most of the time, it has to REPORT in the base case, too!


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

Offline

 

#4743 2012-03-04 13:06:29

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

Re: BYOB 3 - Discussion Thread

@Jens & bharvey
Up to now, I was using Firefox 10 + Windows XP. I could not correctly Save/Load any Snap! applications. I've switched to Chrome, and then "miracle !" now any of my (simple) applications can be Saved/Loaded with no problem, even after Closing/Re-Opening Chrome !Please find an example of these :

http://www.xleroy.net/ByobTuto/New/forrecspi02.gif

Offline

 

#4744 2012-03-04 16:02:46

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

Re: BYOB 3 - Discussion Thread

Chrome has a "Save page" feature which provides one *.htm page where one can read the internal coding of the current Snap! application, It seems promising !

Offline

 

#4745 2012-03-04 16:11:14

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

Re: BYOB 3 - Discussion Thread

we need call/run with input list.
Also, i have an idea:
If you drag a reporter that reports a list onto the left/right arrows of a variadic input slot, it should evaluate the list as the inputs it takes.


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

 

#4746 2012-03-04 23:00:01

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

If you drag a reporter that reports a list onto the left/right arrows of a variadic input slot, it should evaluate the list as the inputs it takes.

Oh, that is a cool idea!  Then we wouldn't need a special case for call and run.  Jens?  What do you think?

Edit:  It'd have to accept any reporter, since in general we can't predict what type a reporter will report.  It's worth noting, although I don't think this rules out the idea, that that introduces another source of runtime errors (ones not prevented by not letting you drop a block where it doesn't belong).  More problematic is that it would totally not be obvious what it means to drop something over the arrows.  It might (sigh) have to be a preferences-enabled capability.

Last edited by bharvey (2012-03-04 23:22:33)


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

Offline

 

#4747 2012-03-05 01:47:58

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

joefarebrother wrote:

If you drag a reporter that reports a list onto the left/right arrows of a variadic input slot, it should evaluate the list as the inputs it takes.

Oh, that is a cool idea!  Then we wouldn't need a special case for call and run.  Jens?  What do you think?

Ummm..., well..., you know that's exactly what my first version did,and I still believe it's the right thing, but you didn't like it so I disabled it. The good thing is that I only need to take out a single line of code to re-enable this feature  smile

But you're right, and now I remember that's the reason why, in fact, both of us wound up not liking it, that this also removes the variadic slot's label which makes the resulting block non-obvious to understand. And that's why we decided to turn the "... WITH INPUT LIST" variations into separate blocks. But if we come up with a better, more concise solution, I'm perfectly willing to reconsider.


Jens Mönig

Offline

 

#4748 2012-03-05 02:07:30

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

BornAgainAtheist wrote:

I get extremely defensive of python, I love python  tongue

Python's okay, except for the whitespace thing and except for using = to mean assignment.  But what big idea does it add that's different from, say, Javascript or Objective C?  Or, maybe I should just say, what do you like about it?

(Don't say "import antigravity.")  smile

I literally just found that comic.  tongue


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

Offline

 

#4749 2012-03-05 06:56:12

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

Re: BYOB 3 - Discussion Thread

xly wrote:

Chrome has a "Save page" feature which provides one *.htm page where one can read the internal coding of the current Snap! application, It seems promising !

So does any modern browser, I think. FF for sure.

Offline

 

#4750 2012-03-05 07:36:19

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

Re: BYOB 3 - Discussion Thread

any chance of regex features?  smile

Offline

 

Board footer