Discuss Scratch

gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Snap! user discussion

Using Snap!, I'm experimenting with first-class functions (a relatively new concept for me)!

when green flag clicked
set [a v] to {{say [Hello!] for (2) secs} ::grey ring}
run (a) ▶::control
Thank you for creating Snap!!
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Snap! user discussion

Yay, lambdas! This is another test script in Snap!:

{+block+((lambda)::grey)+::grey}::control hat
repeat (10)
run (lambda)▶::control
wait (1) secs
end
liam48D
Scratcher
1000+ posts

Snap! user discussion

Chibi-Matoran wrote:

Using Snap!, I'm experimenting with first-class functions (a relatively new concept for me)!

when green flag clicked
set [a v] to {{say [Hello!] for (2) secs} ::grey ring}
run (a) ▶::control
Thank you for creating Snap!!
The fun is when you introduce scope-local variables.

202e-202e-202e-202e-202e UNI-CODE~~~~~
bharvey
Scratcher
1000+ posts

Snap! user discussion

Chibi-Matoran wrote:

Yay, lambdas!
Check out File>Open>Examples>icecream-visual

ChocolatePi
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

Chibi-Matoran wrote:

Yay, lambdas!
Check out File>Open>Examples>icecream-visual
You totally stole that from yourself!

http://www.cs.berkeley.edu/~bh/pdf/ssch01.pdf, page #12
bharvey
Scratcher
1000+ posts

Snap! user discussion

ChocolatePi wrote:

You totally stole that from yourself!
Well, that's only to be expected. Since my entire plan has always been to sneak Scheme into Scratch, naturally I use the same examples as my benchmark.

But in the Scheme version I couldn't do the graphics part.

DigiTechs
Scratcher
500+ posts

Snap! user discussion

bharvey wrote:

ChocolatePi wrote:

You totally stole that from yourself!
Well, that's only to be expected. Since my entire plan has always been to sneak Scheme into Scratch, naturally I use the same examples as my benchmark.

But in the Scheme version I couldn't do the graphics part.

To be honest, I really should learn a functional language - they look really cool. Also much shorter than the imperative version.

I do, in fact, have my own site; it's here.
I'm also working on a thing called Fetch. Look at it here!
@thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain.
ChocolatePi
Scratcher
1000+ posts

Snap! user discussion

DigiTechs wrote:

bharvey wrote:

ChocolatePi wrote:

You totally stole that from yourself!
Well, that's only to be expected. Since my entire plan has always been to sneak Scheme into Scratch, naturally I use the same examples as my benchmark.

But in the Scheme version I couldn't do the graphics part.

To be honest, I really should learn a functional language - they look really cool. Also much shorter than the imperative version.
Functional programming is great! I recommend starting with Scheme rather than Haskell.
bharvey
Scratcher
1000+ posts

Snap! user discussion

ChocolatePi wrote:

I recommend starting with Scheme rather than Haskell.
Scheme then ML. I think Haskell is ugly. YMMV.

ChocolatePi
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

ChocolatePi wrote:

I recommend starting with Scheme rather than Haskell.
Scheme then ML. I think Haskell is ugly. YMMV.
It seems like there's no documentation for ML anywhere else than university courses.

Maybe caml?
bharvey
Scratcher
1000+ posts

Snap! user discussion

ChocolatePi wrote:

It seems like there's no documentation for ML anywhere
http://www.smlnj.org

DigiTechs
Scratcher
500+ posts

Snap! user discussion

bharvey wrote:

ChocolatePi wrote:

It seems like there's no documentation for ML anywhere
http://www.smlnj.org

Thanks for the resources! I'll keep this bookmarked for when I get around to learning a functional language

I do, in fact, have my own site; it's here.
I'm also working on a thing called Fetch. Look at it here!
@thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain.
ChocolatePi
Scratcher
1000+ posts

Snap! user discussion

DigiTechs wrote:

bharvey wrote:

ChocolatePi wrote:

It seems like there's no documentation for ML anywhere
http://www.smlnj.org

Thanks for the resources! I'll keep this bookmarked for when I get around to learning a functional language
They're much better than Java and Lua, that's for sure! More focus on programming, less on structure.
bharvey
Scratcher
1000+ posts

Snap! user discussion

DigiTechs wrote:

I'll keep this bookmarked
Don't forget to bookmark this, too:

https://mitpress.mit.edu/sicp/full-text/book/book.html

xly
Scratcher
100+ posts

Snap! user discussion

Export summary new (?) feature is useful to document a project.
But for strange reasons, when this feature is used to document one project several blank lines are added inside the JS script of blocks using Javascript Function.When reloading the project, blank lines still remain !!!???.

In the meantime I propose 4 projects using a combination of the “grid paradigm” + JS add-on.
See :
http://snap.berkeley.edu/snapsource/snap.html#present:Username=xleroy&ProjectName=XXXXXX
with XXXXX = 100-gridtuto, 100-antcleaner, 100-labyrant, 100-pandemia.

“Its more fun to compete”
Gottlieb
bharvey
Scratcher
1000+ posts

Snap! user discussion

xly wrote:

several blank lines are added inside the JS script
Could you post a screenshot? And, what OS and browser? Thanks.

xly
Scratcher
100+ posts

Snap! user discussion

bharvey wrote:

xly wrote:

several blank lines are added inside the JS script
Could you post a screenshot? And, what OS and browser? Thanks.
Windows10 + Chrome.
Load one of the above mentioned project - they all use JS blocks - and make one export summary (sorry I don't know to post an image)

Last edited by xly (Jan. 10, 2016 11:04:00)

bharvey
Scratcher
1000+ posts

Snap! user discussion

OK thanks. Did all the multiple blank lines happen in one export summary, or did you do it repeatedly? (It doesn't happen for me; I'm guessing it's Windows-specific.)

xly
Scratcher
100+ posts

Snap! user discussion

bharvey wrote:

OK thanks. Did all the multiple blank lines happen in one export summary, or did you do it repeatedly? (It doesn't happen for me; I'm guessing it's Windows-specific.)

You use Export summary for a project having JS Function blocks with no blank lines inside the JS script.
Now you save your project.
Later on you reload the same projects. Blocks using JS scripts have now many additional blank lines included into your JS scripts.
Strangely, in the example, 8 last lines are not stuffed with blank lines !!!
It does not prevent using them.
Each time Export summary is added new blank line are added :
See :
www.xleroy.net/ByobTuto/screen-before.jpg
www.xleroy.net/ByobTuto/screen-after.jpg
bharvey
Scratcher
1000+ posts

Snap! user discussion

Ah, ok, one empty line added between lines each time. I think I understand it – except, as you say, why it doesn't happen at the end… oh, wait, maybe it's only the lines that are visible in the block editor window or something?

Anyway, Jens can't reproduce it on his Windows machine. But we'll look into it more.

Powered by DjangoBB

Standard | Mobile