Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Snap! 5 is here (snap.berkeley.edu)
96 points by TheAsprngHacker on June 28, 2019 | hide | past | favorite | 16 comments


Also:

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

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://snap.berkeley.edu/snapsource/snap.html#present:Usern...

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/

>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

http://lntrg.education.ox.ac.uk/presentation-of-ai-cloud-ser...

Use devices with Snap!:

Orbotix Sphero guide by Connor Hudson and Dan Garcia:

https://docs.google.com/document/d/11wR53OTnofRtTtxZCmxnCUjI...

Lego NXT package by Connor Hudson:

https://github.com/technoboy10/snap-nxt

Nintendo Wiimote package by Connor Hudson:

https://github.com/technoboy10/wiisnap

Finch and Hummingbird robots package by Tom Lauwers:

https://www.hummingbirdkit.com/learning/snap-programming/

Parallax S2 robot package by Connor Hudson:

https://github.com/blockext/s2

LEAP Motion by Connor Hudson:

https://github.com/technoboy10/snapmotion

Speech synthesis by Connor Hudson:

https://github.com/technoboy10/snap2speech

Arduino package by Alan Yorinks:

https://github.com/MrYsLab/s2a_fm

Arduino package by Bernat Romagosa/Citilab:

http://snap4arduino.rocks/

Fischertechnik ROBOTICS TXT Controller by Richard Kunze:

https://github.com/rkunze/ft-robo-snap

Snap! for Raspberry Pi by rasplay.org:

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://www.snap-apps.org/edgy.html

http://www.flipt.org/#cellular

Netsblox for multiplayer networking.

https://netsblox.org/


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


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

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

Y Combinator: https://i.imgur.com/cOq8tvR.png

A* Pathfinding Demo: https://snap.berkeley.edu/snapsource/snap.html#present:Usern... (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 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

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

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

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

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

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


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.


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


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.


Yup, tried setting a 'return' variable. It's less than elegant of course, and there are potential concurrency issues.

Lists can't contain lists, nor can they be passed as inputs to blocks, unless you encode them as text or numbers.


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.


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


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.


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


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.


Here's the elegant Snap! visual Y Combinator:

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.


Snap! takes inspiration from Scheme. I wouldn't compare Scratch to Lisp/Scheme at all, as IMO lambdas, cons-cells, and (the ability to make) expression-based control structures are all defining features of Lisp/Scheme, and Scratch does not have any of them. To my understanding, Scratch's design seems to be inspired by Kay-style OOP (Scratch's "broadcast" feature is about passing messages between sprites, and the first version of Scratch was written in Squeak).


Thank you! That answers all my questions. I'll go play with Snap! then.

BTW. you seem to know your way around these kinds of semi-visual languages; any opinion on NetLogo? A coworker recently introduced me to it, and it looks like a great tool for doing agent simulations. I wonder if you know of anything else worth paying attention to in this space?


I haven't tried it myself, but I've heard it's really cool, and have read people who've used it praising its virtues and discussing its limitations. It sounds like something I'd like, since it's great for agents and cellular automata.

NetLogo – A multi-agent programmable modeling environment (northwestern.edu)

https://news.ycombinator.com/item?id=18180542

https://ccl.northwestern.edu/netlogo/

Seymour Papert has died (mit.edu)

https://news.ycombinator.com/item?id=12201810

http://www.media.mit.edu/people/in-memory/papert

You might also want to check out some of the stuff in these papers, one pretty old, and the other much more recent:

“A Taxonomy of Simulation Software: A work in progress” from Learning Technology Review by Kurt Schmucker at Apple (1999).

http://donhopkins.com/home/documents/taxonomy.pdf

"Gadget Background Survey" by Chaim Gingold (who made Earth Primer), research he did at HARC for the Gadget project with Dan Ingalls (who made Squeak and Lively), which includes Alan Kay's favorites, Rockey’s Boots and Robot Odyssey, and Chaim's amazing SimCity Reverse Diagrams, and lots of great stuff I’d never seen before:

Gadget Background Survey

http://chaim.io/download/Gingold%20(2017)%20Gadget%20(1)%20S...

Earth Primer

https://www.earthprimer.com/

Experimental Gameplay Workshop 2015: Earth Primer

https://www.youtube.com/watch?v=qtsf3nRFfwk

YOW! 2016 Dan Ingalls - Pronto: Toward a Live Designer's Notebook #YOW

https://www.youtube.com/watch?v=if72CFsF_SY

The following NetLogo HN links didn't get as much discussion as they deserved, but here they are:

Show HN: NetLogo Implementation of Conway's Game of Life (github.com)

https://news.ycombinator.com/item?id=20074810

https://github.com/gsurma/game_of_life

Biological Simulations (NetLogo, 2008) [pdf] (northwestern.edu)

https://news.ycombinator.com/item?id=18188139

https://ccl.northwestern.edu/2008/colosimo_paper.pdf

Linking NetLogo with Python [pdf] (surrey.ac.uk)

https://news.ycombinator.com/item?id=18185528

http://jasss.soc.surrey.ac.uk/21/2/4/4.pdf

NetLogo: Design and Implementation of a Multi-Agent Modeling Environment (2004) [pdf] (northwestern.edu)

https://news.ycombinator.com/item?id=18177290

https://ccl.northwestern.edu/papers/agent2004.pdf

Distributed Channel Assignment in Dense WLAN Networks Using NetLogo (thinkmind.org)

https://news.ycombinator.com/item?id=18173939

https://www.thinkmind.org/download.php?articleid=icas_2014_2...

NetLogo (programmable modeling env for simulating natural and social phenomena) [pdf] (northwestern.edu)

https://news.ycombinator.com/item?id=18170128

http://ccl.northwestern.edu/netlogo/docs/NetLogo%20User%20Ma...

Cellular Automata for Pathfinding in NetLogo (cestlaz.github.io)

https://news.ycombinator.com/item?id=10921012

Updated link that works:

https://cestlaz.github.io/posts/2016-01-17-maze-ca.html/

Cellular Automata, NetLogo and real problems

https://news.ycombinator.com/item?id=10913564

Updated link that works:

https://cestlaz.github.io/posts/2016-01-15-shift-image.html/

Some more links and discussion:

https://news.ycombinator.com/item?id=18496880




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: