CSC302 2011S, Class 32: Why LISP? Overview: * Why LISP? * Why not LISP? * Graham's differences: Then and Now * Other issues. Admin: * Missing: AC, CF3, JL * Reading for Friday: McCarthy, John. (1960). Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I. Communications of the ACM 3(4), pp. 184-195. DOI=http://doi.acm.org/10.1145/367177.367199. * Questions on Piazzza! * Due to prereg and College committee work, I need folks to sign up for appointments. Times at http://www.cs.grinnell.edu/~rebelsky/Schedule/signup.2011S.txt. Signup via email. * EC for Ginsburg convo, Thursday. * EC for open discussion with Jane Ginsburg, Thursday, 9:00-10:30 in Mears Cottage. * EC for open discussion with Jane Ginsburg, Thursday, 2:30-4:00 in Mears Cottage. * No CS Extras this week. (What do you think of the prospective title of "Bites and Bits"?) * EC for Friday's CS Table. Why LISP? * It's been around forever. * "A strong basis in math" - and math doesn't get stale * Designed as a mathematical exercise, not as a language * More provable * Code is data and data is code. * It's small (or could be small) * Great conversationb between Mr. Stone and Richard Gabriel * Interpreted- Eval existed early * Concise! - LISP programmers can produce more powerful code faster. * If we buy the argument that "programmers produce a consistent number of lines per day, independent of the language" * Simple syntax * The functional model is very powerful * Try to write a generic sorting routine in C * And try to make it easy to build new comparators * "LISP" encompasses many dialects; one is probably good for what you want to do. * Macros * Effectively create "an entirely new language" * Although still one with lots of parens * Eval on the fly - Easier to patch * Silly joke about customer support * LISP serves as a separator between average programmers and "hackers" Why not LISP? * Self-modifying code is doom for speed on modern architectures. * Zealots are annoying. Zealots with significant superiority complexes are particularly annoying. * Questions about readability of prefix notation. * Too easy to write code that's inefficient without understanding that it's inefficient. (define reverse (lambda (lst) (if (null? lst) null (add-to-end (car lst) (reverse (cdr lst)))))) * The efficient version (define reverse (lambda (lst) (let kernel ((lst lst) (reversed null)) (if (null? lst) reversed (kernel (cdr lst) (cons (car lst) reversed)))))) * It's easy to write unreadable code (define l-s ; left-section (lambda (func left) (lambda (right) (func left right)))) (define add2 (l-s + 2)) (map (l-s * 1.1) grades) (define fun (l-s l-s l-s)) * QUIZ next class * Lexical vs. dynamic scoping * Dynamic typing What made LISP different? * A conditional * Garbage collection * A symbol type What makes LISP different?