SnapManual.pdf | Scratch (Programming Language) | Functional Programming

Please download to get full document.

View again

of 77
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report



Views: 5 | Pages: 77

Extension: PDF | Download: 0

Related documents
Build Your Own Blocks 4.0 SNAP! Reference Manual Brian Harvey Jens Mönig Table of Contents I. Blocks, Scripts, and Sprites 4 VII. Object Oriented Programming 40 Hat Blocks and Command Blocks 5 A. Local State with Script Variables 41 A. Sprites and Parallelism 6 B. Messages and Dispatch Procedures 42 Co
    Build Your Own Blocks 4 Brian Harvey    Jens Mönig    S NAP !  Reference Manual    2 Table of Contents I.   Blocks, Scripts, and Sprites 4   Hat Blocks and Command Blocks 5    A.   Sprites and Parallelism 6    Costumes and Sounds 6   Inter-Sprite Communication with Broadcast 7    B.    Nesting Sprites: Anchors and Parts 8    C.    Reporter Blocks and Expressions 8     D.    Predicates and Conditional Evaluation 10    E.   Variables 11   Global Variables 12   Script Variables 13    F.    Etcetera 13   II.   Saving and Loading Projects and Media 14    A.    Local Storage 14   Localstore 14   XML Export 15    B.   Cloud Storage 15    C.    Loading Saved Projects 16    III.   Building a Block 17    A.   Simple Blocks 17    Custom Blocks with Inputs 19    B.    Recursion 20   C.    Block Libraries 21   IV.   First Class Lists 22    A.   The list   Block 22    B.    Lists of Lists 23   C.    Functional and Imperative List Programming 24    D.    Higher Order List Operations and Rings 25     V.   Typed Inputs 27    A.   Scratch’s Type Notation 27     B.   The ! #$%  Input Type Dialog 27    Procedure Types 28   Pulldown inputs 29   Input variants 30   Prototype Hints 31   Title Text and Symbols 31    VI.   Procedures as Data 32    A.   Call and Run 32   Call / Run with inputs  32   Variables in Ring Slots 33    B.   Writing Higher Order Procedures 33   Recursive Calls to Multiple-Input Blocks 35   C.    Formal Parameters 36     D.    Procedures as Data 37     E.   Special Forms 38    Special Forms in Scratch 39    VII.   Object Oriented Programming 40    A.    Local State with Script Variables 41    B.    Messages and Dispatch Procedures 42   C.    Inheritance via Delegation 43    D.    An Implementation of Prototyping OOP 43    VIII.   The Outside World 47    A.   The World Wide Web 47     B.    Hardware Devices 48    C.    Date and Time 48    IX.   Continuations 49    A.   Continuation Passing Style 50    B.   Call/Run w/Continuation 53   Nonlocal exit 55   X.   User Interface Elements 57    A.   Tool Bar Features 57    The ! #$ % Logo Menu 57   The File Menu 58   The Cloud Menu 61   The Settings Menu 62   Stage Resizing Buttons 64   Project Control Buttons 64    B.   The Palette Area 65    Context Menus for Palette Blocks 65   Context Menu for the Palette Background 66   C.   The Scripting Area 66    Sprite Appearance and Behavior Controls 66   Scripting Area Tabs 67   Scripts and Blocks Within Scripts 67   Scripting Area Background Context Menu 68   Controls in the Costumes Tab 70   The Paint Editor 71   Controls in the Sounds Tab 72    D.   Controls on the Stage 72    E.   The Sprite Corral and Sprite Creation Buttons 73   Index 75  3  Acknowledgements We have been extremely lucky in our mentors. Jens cut his teeth in the company of the Smalltalk pioneers: Alan Kay, Dan Ingalls, and the rest of the gang who invented personal computing and object oriented programming in the great days of Xerox PARC. He worked with John Maloney, of the MIT Scratch Team, who developed the Morphic graphics framework that’s still at the heart of ! #$ % . The brilliant design of Scratch, from the Lifelong Kindergarten Group at the MIT Media Lab, is crucial to ! #$ ! . Our earlier version, BYOB, was a direct modification of the Scratch source code. ! #$ !  is a complete rewrite, but its code structure and its user interface remain deeply indebted to Scratch. And the Scratch Team, who could have seen us as rivals, have been entirely supportive and welcoming to us. Brian grew up at the MIT and Stanford Artificial Intelligence Labs, learning from Lisp inventor John McCarthy, Scheme inventors Gerald J. Sussman and Guy Steele, and the authors of the world’s best computer science book, Structure and Interpretation of Computer Programs, Hal Abelson and Gerald J. Sussman with Julie Sussman, among many other heroes of computer science. In the glory days of the MIT Logo Lab, we used to say, “Logo is Lisp disguised as BASIC.” Now, with its  first class procedures, lexical scope, and first class continuations,   ! #$ !  is Scheme disguised as Scratch. We have been fortunate to get to know an amazing group of brilliant middle school(!) and high school students through the Scratch Advanced Topics forum, several of whom have contributed code to ! #$ % : Kartik Chandra, Nathan Dinsmore, Connor Hudson, and Ian Reynolds. Many more have contributed ideas and alpha-testing bug reports. UC Berkeley students who’ve contributed code include Michael Ball, Achal Dave. Kyle Hotchkiss, Ivan Motyashov, and Yuan Yuan. Contributors of translations are too numerous to list here, but they’re in the “About…” box in ! #$ % itself. This work was supported in part by the National Science Foundation grant 1143566, and in part by MioSoft.  4 ! #$ !   Reference Manual  Version 4.0 ! #$ %  (formerly BYOB) is an extended reimplementation of Scratch (  hp://  ) that allows you to Build Your Own Blocks. It also features first   class lists, first   class procedures, and continuations. These added capabilities make it suitable for a serious introduction to computer science for high school or college students. To run ! #$ % ,   open a browser window and connect to either hp://  to start with a minimal set of blocks or  hp://  to load a small set of additional blocks (a little slower startup, but recommended for convenience and assumed in this manual). I. Blocks, Scripts, and Sprites This secction describes the ! #$ %   features inherited from Scratch; experienced Scratch users can skip to subsection B. ! #$ %   is a programming language — a notation in which you can tell a computer what you want it to do. Unlike most programming languages, though, ! #$ %   is a visual language; instead of writing a program using the keyboard, the ! #$ %   programmer uses the same drag-and-drop interface familiar to computer users. Start ! #$ % . You should see the following arrangement of regions in the window: (The proportions of these areas may be different, depending on the size and shape of your browser window.) A ! #$ %   program consists of one or more scripts, each of which is made of blocks. Here’s a typical script:
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks