
Snap! 5 is here - TheAsprngHacker
https://snap.berkeley.edu/site/blog
======
DonHopkins
Also:

[https://news.ycombinator.com/item?id=17594403](https://news.ycombinator.com/item?id=17594403)

One of the coolest ways to learn programming I've ever seen is the Snap!
visual programming language, which is written in JavaScript and runs in the
browser. [https://snap.berkeley.edu](https://snap.berkeley.edu)

It's the culmination of years of work by Brian Harvey and Jens Mönig and other
Smalltalk and education experts. It benefits from their experience and expert
understanding about constructionist education, Smalltalk, Scratch, E-Toys,
Lisp, Logo, Star Logo, and many other excellent systems.

Snap! takes the best ideas, then freshly and coherently synthesizes them into
a visual programming language that kids can use, but is also satisfying to
professional programmers, with all the power of Scheme (lexical closures,
special forms, macros, continuations, user defined functions and control
structures), but deeply integrating and leveraging the web browser and the
internet (JavaScript primitives, everything is a first class object,
dynamically loaded extensions, etc).

Y Combinator demo:

[https://i.imgur.com/cOq8tvR.png](https://i.imgur.com/cOq8tvR.png)

[https://snap.berkeley.edu/snapsource/snap.html#present:Usern...](https://snap.berkeley.edu/snapsource/snap.html#present:Username=jens&ProjectName=y%20combinator)

Here's an excellent mind-blowing example by Ken Kahn of what's possible:
teaching kids AI programming by integrating Snap! with existing JavaScript
libraries and cloud services like AI, machine learning, speech synthesis and
recognition, Arduino programming, etc:

AI extensions of Snap! for the eCraft2Learn project

[https://ecraft2learn.github.io/ai/](https://ecraft2learn.github.io/ai/)

>The eCraft2Learn project is developing a set of extensions to the Snap!
programming language to enable children (and non-expert programmers) to build
AI programs. You can use all the AI blocks after importing this file into
Snap! or Snap4Arduino. Or you can see examples of using these blocks inside
this Snap! project.

[https://github.com/ecraft2learn/ai](https://github.com/ecraft2learn/ai)

[http://lntrg.education.ox.ac.uk/presentation-of-ai-cloud-
ser...](http://lntrg.education.ox.ac.uk/presentation-of-ai-cloud-services-
integrated-with-snap-at-the-connective-ubiquitous-technology-for-embodiments-
center-of-the-national-university-of-singapore-and-keio-university-
on-16-march-2017-by-k/)

Use devices with Snap!:

Orbotix Sphero guide by Connor Hudson and Dan Garcia:

[https://docs.google.com/document/d/11wR53OTnofRtTtxZCmxnCUjI...](https://docs.google.com/document/d/11wR53OTnofRtTtxZCmxnCUjIlFQjnGewM21A0vmjtFw/edit?usp=sharing)

Lego NXT package by Connor Hudson:

[https://github.com/technoboy10/snap-nxt](https://github.com/technoboy10/snap-
nxt)

Nintendo Wiimote package by Connor Hudson:

[https://github.com/technoboy10/wiisnap](https://github.com/technoboy10/wiisnap)

Finch and Hummingbird robots package by Tom Lauwers:

[https://www.hummingbirdkit.com/learning/snap-
programming/](https://www.hummingbirdkit.com/learning/snap-programming/)

Parallax S2 robot package by Connor Hudson:

[https://github.com/blockext/s2](https://github.com/blockext/s2)

LEAP Motion by Connor Hudson:

[https://github.com/technoboy10/snapmotion](https://github.com/technoboy10/snapmotion)

Speech synthesis by Connor Hudson:

[https://github.com/technoboy10/snap2speech](https://github.com/technoboy10/snap2speech)

Arduino package by Alan Yorinks:

[https://github.com/MrYsLab/s2a_fm](https://github.com/MrYsLab/s2a_fm)

Arduino package by Bernat Romagosa/Citilab:

[http://snap4arduino.rocks/](http://snap4arduino.rocks/)

Fischertechnik ROBOTICS TXT Controller by Richard Kunze:

[https://github.com/rkunze/ft-robo-snap](https://github.com/rkunze/ft-robo-
snap)

Snap! for Raspberry Pi by rasplay.org:

[http://downloads.rasplay.org/pisnap/](http://downloads.rasplay.org/pisnap/)

More Snap! extensions for CS education:

snap-apps.org provides Edgy for graphs, Cellular for multi-agent simulation,
and more.

[http://snap-apps.org/](http://snap-apps.org/)

[http://www.snap-apps.org/edgy.html](http://www.snap-apps.org/edgy.html)

[http://www.flipt.org/#cellular](http://www.flipt.org/#cellular)

Netsblox for multiplayer networking.

[https://netsblox.org/](https://netsblox.org/)

~~~
throw97
I was very excited about this until I actually tried it. It is toooo slow.
Donno why.

------
DonHopkins
I posted this before about a previous version of Snap!:

[https://news.ycombinator.com/item?id=17056444](https://news.ycombinator.com/item?id=17056444)

I was hoping that second one was about Scratch, the visual blocks programming
language for kids, similar to Logo, based on a Smalltalk development
environment (which is a lot better than X!)

If you're interested in visual programming with a powerful Scheme-like
language with first class functions, closures, special forms, macros, and even
continuations so you can define your own control structures, check out Snap!
(The exclamation mark is part of the name, so it's easy to get excited about
Snap!)

It's a descendent of Scratch but more powerful, hand-written in JavaScript
instead of Smalltalk, and it integrates easily with JS code. (There's a user
defined JavaScript function block that you can use to integrate with the Snap
VM and the browser!)

Snap was written by Jens Mönig and Brian Harvey, who know what they're doing!
;)

[https://snap.berkeley.edu](https://snap.berkeley.edu)

Y Combinator:
[https://i.imgur.com/cOq8tvR.png](https://i.imgur.com/cOq8tvR.png)

A* Pathfinding Demo:
[https://snap.berkeley.edu/snapsource/snap.html#present:Usern...](https://snap.berkeley.edu/snapsource/snap.html#present:Username=jens&ProjectName=PathFinder)
(press the diagonal arrow button at the top to see the block code in the
development environment!)

Snap! is a visual programming language inspired by Scratch. Run Snap! in your
browser at [http://snap.berkeley.edu/run](http://snap.berkeley.edu/run) The
IIIA1 in the title means that this is the first tutorial corresponding to
Chapter III, Section A of the Reference Manual at
[http://snap.berkeley.edu/SnapManual.pdf](http://snap.berkeley.edu/SnapManual.pdf)

Snap! Tutorial IIIA1: Make a block
[https://www.youtube.com/watch?v=Bbl2fh3igQ4](https://www.youtube.com/watch?v=Bbl2fh3igQ4)

Snap! Tutorial IIIA2: Custom Blocks with Inputs:
[https://www.youtube.com/watch?v=hZC2tDVYWBo](https://www.youtube.com/watch?v=hZC2tDVYWBo)

The Basics of Snap!
[https://www.youtube.com/watch?v=hAxqwwg4uhk](https://www.youtube.com/watch?v=hAxqwwg4uhk)

Prototypical Inheritance in Snap! (no audio)
[https://www.youtube.com/watch?v=lvlWvHgfrlw](https://www.youtube.com/watch?v=lvlWvHgfrlw)

Editing Formulas in Snap! (no audio)
[https://www.youtube.com/watch?v=ahHAl3p3gEU](https://www.youtube.com/watch?v=ahHAl3p3gEU)

------
jacknews
Yes! My son is getting into Scratch (50 projects in the last couple of
months), but it has at least a couple of serious limitations as a programming
language, namely no return values from functions/blocks, and lists are not
first-class, making it unnecessarily complex to implement data structures.

The one thing keeping him on Scratch (or rather, away from Snap) is the
Scratch community/sharing. I'll have him and his friends consider joining Snap
now.

~~~
ngmc
Scratch lists seem relatively first-class to me. Your son could probably have
fun building simple data structures with them by making blocks that take an
input. He can also update a "return" variable if the situation calls for it.

[https://en.scratch-wiki.info/wiki/List](https://en.scratch-
wiki.info/wiki/List)

~~~
TheAsprngHacker
Scratch lists are not first class. You can only create them as variables; you
can't create list "values" (there are no list literals) and you can't pass
lists around. You can only provide lists as arguments by choosing list
variables from a dropdown of certain built-in blocks.

------
sinuhe69
I love snap! It's IMO the only visual system with them one can teach
programming seriously and properly. The only problem is its slow loading
speed. And I mean really slow. Any program takes minutes to load (on a iPad).
In comparison, program in Scratch 3 (also implemented in JS) takes only
seconds to load. Otherwise, it's a perfect system to teach children
programming.

------
TeMPOraL
What's the difference between Snap! and Scratch? They look prima facie
identical.

~~~
DonHopkins
Scratch is a simplified version of Lisp/Scheme, without many important
features like first class functions, lexical closures, continuations, special
forms, the ability to define your own blocks and control structures, and
everything being a first class object that you can bind to variables, pass
around, and return from functions.

Snap! supports all those important features of Scheme (its original name was
BYOB for "Build Your Own Blocks"), with the visual interface and sprite and
stage and turtle graphics of Scratch, plus it's written in JavaScript, so it's
efficient and easy to integrate with existing JavaScript libraries (see
"etoys2learn"!), instead of running in a monolithic Smalltalk virtual machine.

~~~
ngmc
Scratch does allow you to make your own blocks with optional input. My math
students use them to learn about abstraction. The most recent implementation
was released last winter and is written in JavaScript.

[https://en.scratch-wiki.info/wiki/Scratch_3.0](https://en.scratch-
wiki.info/wiki/Scratch_3.0)

~~~
toontalk
Scratch 3 does not enable one to define new functions only new commands. Snap!
user-defined functions are first-class - they can be used to define higher-
order functions.

~~~
DonHopkins
Here's the elegant Snap! visual Y Combinator:

[https://imgur.com/cOq8tvR](https://imgur.com/cOq8tvR)

Visual Lambda: Note how the gray block after the "report", shrink-wrapped
around the "call (fn) with inputs (fn) []", is a visual "lambda". It looks
like a "gasket" or "baggie" that insulates the code inside from being
immediately evaluated, returning a closure instead.

