“Lisp Basics and Idioms” Presentation from Intro to Lisp Workshop

This is an HTML version of the slides from my “Lisp Basics and Idioms” presentation at the Chicago Lisp User Group’s Intro to Lisp Workshop. It’s also videotaped but it will take a while to transfer it to digital, edit it, etc. It was a good presentation (IMHO) worth waiting for, but here’s the sneak peek (with links!).

If you want to look at the .ppt, you can download it here, but it’s pretty bare (or ugly, depending on how charitable you are), it doesn’t have as much info as the version below (no links, fewer references), and it is missing all of the good verbal ad-libbing I did when presenting. But hey, I’m not complaining if you want to see it!

***Lisp Basics and Idioms***

Lisp Is Old

Lisp Is New

Lisp Is A Family of Languages

  • Common Lisp: ANSI Standard written in the 80s caused languages to coalesce, then implementations to flourish
  • Scheme: A conceptually cleaner variant with a smaller specification
  • Proprietary: LispWorks, Allegro
  • Open Source: SBCL, CLisp
  • Others: compile to C, run on JVM, etc

Lisp Is Functional, But Not Strictly

  • Functional is the most natural to write
  • Can make sequential blocks, either explicitly or in constructs
  • Can make and change values if needed
  • Can build and incorporate new paradigms as necessary, i.e. CLOS
  • Lisp is strongly typed, dynamic typed

Lisp Has Lots of Parentheses

  • “Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in.” -Larry Wall
  • Used to group expressions
  • Makes syntax simple and consistent
  • Most forms are (function args*)

But the Parentheses Aren’t a Big Deal

  • “Parentheses? What parentheses? I haven’t noticed any parentheses since my first month of Lisp programming. I like to ask people who complain about parentheses in Lisp if they are bothered by all the spaces between words in a newspaper” – Ken Tilton
  • Editors indent automatically
  • Emacs commands to balance and close parens
  • Paredit (Emacs library) lets you manipulate sexps directly

Lisp Uses Symbols

  • Like variables but better
  • Like pointers but less dangerous
  • Assign a name to a value
  • Values can be lots of things – numbers, strings, functions, lists, other data structures

Lisp Has First Class Functions

  • Easy to define
    • (defun hello-world () (format t “hello, world”))
  • Can be passed as parameters
  • Can be returned as values from other functions
  • Anonymous functions too!

Lisp Has Flexible Parameters

  • Parameters can be optional, with defaults
    • (defun foo (a &optional b) (list a b))
    • (defun foo2 (a &optional (b 10)) (list a b))
  • Parameter lists can be variable length
    • (defun + (&rest numbers) …)
  • Keyword parameters
    • (defun foo3 (&key a b) …)

Lisp Uses Pairs

Lisp Uses Lists

  • “It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures.” – Alan J. Perlis
  • Tons of functions for manipulating lists
  • Useful for recursive definitions
  • Lists aren\’t perfect so…

Lisp Has More Than Just Lists

  • Collections
  • Vectors – fixed size sequences
  • Arrays – can be multidimensional, resizable
  • Sequence functions on collections – COUNT, FIND, POSITION, REMOVE, SUBSTITUTE, etc
  • This is one place where syntax would help
  • (aref a 5) instead of a[5]

Lisp Does Lots More

Lisp Has Lots of Free Online Resources


  1. Foster Lee says

    Not only was the intro superb, but the now all the relevant links as well?! I thought all we’d get was a .ppt dump–wowza!


Leave a Reply

Your email address will not be published. Required fields are marked *