CSC302 2011S, Class 19: Clojure (2) Overview: * Review of highlights * Lab. Admin: * Assignment 7 almost released. (Discussed in class.) * We will skip day 3 of Clojure and move on to Haskell next week. * No need to read clojure-3. * Wednesday: Growing a Language. Friday: The Design of C++. Big Points of Section N.3. * Macros: * Manipulates program TEXT rather than data * Effect: delays execution * Recursion in Clojure * Need special syntactic sugar to get efficient tail recursion * Why can't Clojure do sensible tail recursion? The claim is "It's the JVM", but that seems specious. * Sequences * Can build lazy sequences: Only evaluated "when needed", possibly infinite * "Object-oriented" - Protocols that you implement * Organized * Syntactic sugar for common "object" stuff. * Lets you interface with Java and Microstuff. * Gives you the wonder of "Lists and Maps and Sets are all sequences." * Polymorphism done the right way "list cons does X" "vector cons does X" ... rather than (defn cons [thing] (cond ((list? thing) ...) ((vector? thing) ...)))