Snap is the programming language used in UC Berkeley’s introductory CS course named “The Beauty and Joy of Computing” (BJC). As part of the BJC curriculum, Snap is currently being disseminated nationwide across the U.S. to support the new AP CS-Principles course created by the College Board. The NSF has awarded longstanding grants to bring Snap and BJC to every high school in New York City, the largest school district in the U.S.
Snap is Scheme disguised as Scratch, a free and open web browser based visual programming language aiming to support a technically rigorous introductory CS curriculum at the college and high school level. Snap has been translated into 39 languages and is used around the world, both as a teaching environment and in research projects.
Snap borrows from Scratch its graphical LEGO blocks grammar and its 2D cartoon themed microworld around a stage with sprite actors, costumes, events, and parallelism, combining it with Scheme’s dynamically typed and lexically scoped variables, first-class lists, lambda (closures), first-class continuations and proper tail recursion, encouraging programmers to create their own control structures (loops, catch/throw, higher-order functions such as map/filter/reduce) tail recursively without having to worry about stack overflows. Snap supports nested sprites and lets programmers turn arbitrary JavaScript code into graphical blocks. Its “codification” mechanism can transcompile graphical scripts into arbitrary textual code, offering a two-way transition between blocks and text.
Snap is implemented in JavaScript using HTML5 APIs. It has been renamed from BYOB to Snap since version 4.0. Snap’s development has been supported by two NSF grants.