Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

An introduction to SLIME, the Superior Lisp Interaction Mode for Emacs.

This talk was given at ILUGD, March 2009 meeting at JNU, New Delhi.

The same talk was given a week later at OSSCamp, held at IIT Delhi on March 29.

Published in: Technology, Education


  1. 1. SLIME The Superior Lisp Interaction Mode for Emacs An Introduction -- Chaitanya Gupta
  2. 2. Common Lisp: Syntax No Syntax Well, actually there is, but...
  3. 3. Common Lisp: Syntax Prefix Notation (operator arg1 arg2 ...) A List (Lisp == LISt Processor)
  4. 4. CL Examples <ul><ul><li>Arithmetic operations (+ 4 5 6) => 15 (* 10 20) => 200 (/ 60 9) => 20/3 </li></ul></ul><ul><ul><li>Comparisons (= 5 5) => T (<= 10 5) => NIL </li></ul></ul>
  5. 5. CL Examples <ul><ul><li>Strings (length “foobar”) => 6 (string-upcase “quux”) => “QUUX” </li></ul></ul><ul><ul><li>Assignment (setf x 9) => 9 (setf y (+ x 10)) => 19 </li></ul></ul>
  6. 6. CL Examples <ul><ul><li>Flow Control (if (< x y) (print “foo”) (print “bar”)) </li></ul></ul><ul><ul><li>Iteration (dotimes (i 10) (print “Hello World!”)) </li></ul></ul>
  7. 7. CL Examples <ul><ul><li>Functions (defun factorial (n) (if (<= n 1) 1 (* n (factorial (1- n))))) (factorial 0) => 1 (factorial 5) => 120 </li></ul></ul>
  8. 8. The REPL Read Eval Print Loop
  9. 9. Architecture SLIME SWANK Client Server Emacs SBCL, CMUCL, CLISP, etc.
  10. 10. Evaluation <ul><li>C-x C-e M-x slime-eval-last-expression </li></ul><ul><li>C-M-x M-x slime-eval-last-defun </li></ul><ul><li>C-c C-r M-x slime-eval-region </li></ul>
  11. 11. Compilation <ul><li>C-c C-c M-x slime-compile-defun </li></ul><ul><li>C-c C-k M-x slime-compile-and-load-file </li></ul><ul><li>M-n M-x slime-next-note </li></ul><ul><li>M-p M-x slime-previous-note </li></ul>
  12. 12. Completion <ul><li>TAB M-x slime-complete-symbol </li></ul><ul><li>M-TAB M-x slime-fuzzy-complete-symbol </li></ul>
  13. 13. Documentation <ul><li>SPC M-x slime-space </li></ul><ul><li>C-c C-d d M-x slime-describe-symbol </li></ul><ul><li>C-c C-d a M-x slime-apropos </li></ul><ul><li>C-c C-d h M-x slime-hyperspec-lookup </li></ul>
  14. 14. Finding Definitions <ul><li>M-. M-x slime-edit-definition </li></ul><ul><li>M-, M-* M-x slime-pop-find-definition-stack </li></ul><ul><li>(the “Meta-point” commands) </li></ul>
  15. 15. Inspector <ul><li>C-c I M-x slime-inspect </li></ul><ul><li>Some Inspector commands </li></ul><ul><ul><li>RET M-x slime-inspector-operate-on-point </li></ul></ul><ul><ul><li>l M-x slime-inspector-pop </li></ul></ul><ul><ul><li>n M-x slime-inspector-next </li></ul></ul><ul><ul><li>M-RET M-x slime-inspector-copy-down </li></ul></ul>
  16. 16. Cross-reference <ul><li>C-c C-w c M-x slime-who-calls </li></ul><ul><li>C-c C-w w M-x slime-calls-who </li></ul><ul><li>C-c C-w r M-x slime-who-references </li></ul><ul><li>C-c C-w b M-x slime-who-binds </li></ul><ul><li>C-c C-w s M-x slime-who-sets </li></ul>
  17. 17. Disassembly <ul><li>C-c M-d M-x slime-disassemble-symbol </li></ul><ul><li>C-c C-t M-x slime-toggle-trace-definition </li></ul><ul><li>M-x slime-untrace-all </li></ul>
  18. 18. SLDB: the SLIME debugger <ul><li>Examining Frames </li></ul><ul><ul><li>t M-x sldb-toggle-details </li></ul></ul><ul><ul><li>v M-x sldb-show-source </li></ul></ul><ul><ul><li>e M-x sldb-eval-in-frame </li></ul></ul><ul><ul><li>i M-x sldb-inspect-in-frame </li></ul></ul>
  19. 19. SLDB: the SLIME debugger <ul><li>Frame Navigation </li></ul><ul><ul><li>n M-x sldb-down </li></ul></ul><ul><ul><li>p M-x sldb-up </li></ul></ul><ul><ul><li>M-n M-x sldb-details-down </li></ul></ul><ul><ul><li>M-p M-x sldb-details-up </li></ul></ul>
  20. 20. SLDB: the SLIME debugger <ul><li>Miscellaneous commands </li></ul><ul><ul><li>r M-x sldb-restart-frame </li></ul></ul><ul><ul><li>R M-x sldb-return-from-frame </li></ul></ul><ul><ul><li>C M-x sldb-inspect-condition </li></ul></ul><ul><ul><li>q M-x sldb-quit </li></ul></ul>
  21. 21. How CL helps <ul><li>eval </li></ul><ul><li>compile, compile-file, load </li></ul><ul><li>describe, documentation </li></ul><ul><li>apropos </li></ul><ul><li>sb-introspect:who-calls, sb-introspect:who-references, etc. </li></ul><ul><li>disassemble </li></ul><ul><li>trace, step </li></ul><ul><li>inspect </li></ul>
  22. 22. CL Resources <ul><li>Lisp implementations </li></ul><ul><ul><li>SBCL -- </li></ul></ul><ul><ul><li>CMUCL -- </li></ul></ul><ul><ul><li>CLISP -- </li></ul></ul><ul><ul><li>Clozure CL -- </li></ul></ul><ul><ul><li>AllegroCL (commercial) -- </li></ul></ul><ul><ul><li>Lispworks (commercial) -- </li></ul></ul><ul><ul><li>Scineer CL (commercial) -- </li></ul></ul><ul><ul><li>and more ... </li></ul></ul>
  23. 23. CL Resources <ul><li>Emacs -- </li></ul><ul><li>SLIME -- </li></ul><ul><li>Paredit -- </li></ul>
  24. 24. CL Resources <ul><li>Books </li></ul><ul><ul><li>Practical Common Lisp (by Peter Seibel) </li></ul></ul><ul><ul><li>Common Lisp: A Gentle Introduction to Symbolic Computation </li></ul></ul><ul><ul><li>On Lisp (by Paul Graham) </li></ul></ul><ul><ul><li>Paradigms of AI Programming: Case Studies in Common Lisp (by Peter Norvig) </li></ul></ul><ul><ul><li>Structure and Interpretation of Computer Programs (by Harold Abelson and Gerald Jay Sussman with Julie Sussman) </li></ul></ul>
  25. 25. CL Resources <ul><li>CL Tutorials </li></ul><ul><ul><li>Casting SPELs in Lisp </li></ul></ul><ul><ul><li>A Tutorial on Conditions and Restarts </li></ul></ul><ul><ul><li>Lisp for the Web </li></ul></ul>