CSC153.02, Class 2: Starting Scheme Admin: * About the book in the bookstore * Surveys due late tonight (or before) * Lots of reading for tomorrow (Symbols, Lists, Numbers) * Convo today! Overview * An abbreviated history of Scheme * Scheme basics * Lab: DrScheme * Lab: Scheme Basics How did we get to the point that you're learning Scheme in 153? (A rhetorical question) * In the early days of computing, there were no "programming languages" * John von Neumann (sp?) suggested that we could treat the program as input to the computer * In the early and mid 1950's, most programming was done with "virtual wires" * Soon people realized that mnemonics were more helpful: Assembly was born * In the late 1950's, people started designing "high level" programming languages that looked much more like what "people" (i.e. Physicists, Businessmen) might write * Fortran (FORmula TRANslation): Numeric computation * COBOL (COmmon Businness-Orieneted Language): Information processing /business * LISP (LIst Processing Language): Representing knowledge * McCarthy's conclusions: * People use symbols to represent concepts; symbols should be a data type * People tend to group things together (often in lists): lists should be a data type * Function application is useful * Also: "Hmmm ... this Lambda Calculus stuff that my colleagues are telling me about sounds interesting, I'll include it, too." * The result: LISP (ca. 1958) * There were some clear design flaws in LISP. * In the late 1970's, a group of computer scientists (primarily at MIT) decided to write an "improved" LISP: More features based on new knowledge in CS; better for teaching: The result: Scheme (not an acronym) * Cool features of Scheme: * Symbols as data type * Lists as data type * Functions as the key model * Functions that apply to other functions * Anonymous function * Why teach Scheme first? * Those cool features help you think about things you might not think about otherwise * Scheme has a simpler syntax than almost any other language * Scheme forces you to recurse Why do some misguided bozos think Scheme is bad? * They are not talented enough to understand recursion * Scheme has more parens than anyone in their right mind would like * They don't think for themselves and other people told them that Scheme is bad * Scheme lacks some important features, such as compile-time type checking * Programming languages are like religions * Proponents of Scheme are often annoying A little bit about Scheme * Often interpreted * Most common thing: Type an "expression" (application of a function to arguments) and ask Scheme to compute the result * The syntax of expressions (FUNCTION ARG1 ARG2 ARG3) (+ 1 2) (* 3 (+ 1 2)) To compose the increment and square operations ((compose increment square) 2) Lab: Start DrScheme, our programming environment Lab: Play with Scheme Post-lab reflections: * How to change your password * Click on the "terminal" icon * Type "passwd" (no quotes) * Follow the instructions * How to edit the previous command: ESC-P gives you a copy * The DrScheme lab is intentionally written with two sets of instructions * The compose example, revisited (define munge (compose increment square)) (munge 2)