CSC151.01 2007S, Class 04: Beginning Scheme Admin: * Due: HW 2 * Please do not address me in the generic * How Extra Credit works: * At the end of the semester, Sam distributes checklist * Students check off appropriate boxes * Sam counts * Last-minute recommendations ate my Thursday. Expect responses to HW1 and HW2 over the weekend. * There are two readings for Monday: * Symbolic values in Scheme * Lists in Scheme * HW3 is now ready. Overview: * Why use programming languages? * Scheme basics. * Scheme history. * Lab. /About programming languages/ * We are writing algorithms in this weird that doesn't look like English (or math or ...) * Algorirthms for the computer (i.e., programs) are ALWAYS written in an artificial language * Artificial languages can be simpler * Easier to make the computer understand them - Easier to translate them to a language the computer does understand * Less likely to be ambiguous * Artificial languages can be more precise * Term for figuring out structure of a statement (English, Computer language, whatever): "Parse" * Time flies like an arrow * Fruit flies like a banana * Artificial languages let us solve these problems * Artificial languages are also easier to teach /Scheme: A Simple Programming Language with a Weird Syntax/ * Primary grammatical structure: "Evaluate a function on arguments" * Open paren ( * Name of the function + * Arguments, separated by spaces 3 4 * Close paren (+ 3 4) * Implications: * An open paren tells Scheme "Look for a function to come next" ((+ 3 4)) * When you want to apply a function, you need an open paren /Scheme's History/ * Based on LISP, designed in 1959 as an AI language * Improved in the 1970s into Scheme for *teaching* * And with a clearer set of meanings /Lab!/ * Why is (+) 0 and (*) 1? * What does - do?