Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Snap! user discussion
- 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 clickedThank you for creating Snap!!
set [a v] to {{say [Hello!] for (2) secs} ::grey ring}
run (a) ▶::control
- 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
Snap!, I'm experimenting with first-class functions (a relatively new concept for me)!The fun is when you introduce scope-local variables. Usingwhen green flag clickedThank you for creating Snap!!
set [a v] to {{say [Hello!] for (2) secs} ::grey ring}
run (a) ▶::control
202e-202e-202e-202e-202e UNI-CODE~~~~~
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
Check out File>Open>Examples>icecream-visual Yay, lambdas!
- ChocolatePi
- Scratcher
1000+ posts
Snap! user discussion
You totally stole that from yourself!Check out File>Open>Examples>icecream-visual Yay, lambdas!
http://www.cs.berkeley.edu/~bh/pdf/ssch01.pdf, page #12
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
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. You totally stole that from yourself!
But in the Scheme version I couldn't do the graphics part.
- DigiTechs
- Scratcher
500+ posts
Snap! user discussion
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. You totally stole that from yourself!
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
Functional programming is great! I recommend starting with Scheme rather than Haskell.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. You totally stole that from yourself!
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.
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
Scheme then ML. I think Haskell is ugly. YMMV. I recommend starting with Scheme rather than Haskell.
- ChocolatePi
- Scratcher
1000+ posts
Snap! user discussion
It seems like there's no documentation for ML anywhere else than university courses.Scheme then ML. I think Haskell is ugly. YMMV. I recommend starting with Scheme rather than Haskell.
Maybe caml?
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
It seems like there's no documentation for ML anywherehttp://www.smlnj.org
- DigiTechs
- Scratcher
500+ posts
Snap! user discussion
It seems like there's no documentation for ML anywherehttp://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
They're much better than Java and Lua, that's for sure! More focus on programming, less on structure.It seems like there's no documentation for ML anywherehttp://www.smlnj.org
Thanks for the resources! I'll keep this bookmarked for when I get around to learning a functional language
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
Don't forget to bookmark this, too: I'll keep this bookmarked
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
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
Could you post a screenshot? And, what OS and browser? Thanks. several blank lines are added inside the JS script
- xly
- Scratcher
100+ posts
Snap! user discussion
Windows10 + Chrome.Could you post a screenshot? And, what OS and browser? Thanks. several blank lines are added inside the JS script
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
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.
Anyway, Jens can't reproduce it on his Windows machine. But we'll look into it more.