Lisp Cheat Sheet



OverAPI.com is a site collecting all the cheatsheets,all! Common Lisp is very big - if you need a complete reference to Common Lisp to find just that function you're looking for, try Harlequin's Common Lisp HyperSpec. Paul Graham's book On Lisp, a fine book on advanced Lisp, is out of print. So he has graciously made it available online! Including source code. Replacing cond by case x results in an exhaustive case-analysis: If x is the literal expression testᵢ then yield exprᵢ, if no match happens, crash —to use a default, just have a default value as the final expression, no need to precede it by anything.A hybrid of cond and case is condp. Block of Code do and control flow and,. Use the do function to treat multiple expressions as a. This documentation tool is a cheat-sheet and a concept-navigation aid, its goal is to help Common Lisp programmers quickly browse symbols for their definition and usage. The listings are example-driven, paired with concise descriptions, and providing readily available links to more comprehensive references.

On this Valentine’s Day, give the gift people really want – complex key chords!

In other news, I’ve got fans!

Well, at least one anyway. A lot of the feedback I’ve received on this site so far has been from experienced Lispers who appreciate my enthusiasm and contributions for new users. Yesterday, I got the first (I think) comment and reply from another new Lisper who’s actually getting some use out of my stuff. Aaron Fengwrote up my SLIME movie reference, and he even caught my later reference to my upcoming “Ultimate N00b SLIME/Emacs Cheat Sheet”. Well Aaron, wait no more!

Lisp cheat sheet free

I’ve been using it for a week or so, and I’m sort of pleased with it. First the positives:

  • It includes all of the SLIME commands from the SLIME manual
  • It includes all of the Emacs commands from the built in tutorial
  • It includes the main Emacs help keys
  • The commands are sorted and grouped by functional area
  • It’s all fits on one page

Here are some of the things I’m not so pleased with:

  • It has very few Emacs commands, relative to what’s available
  • It doesn’t include any advanced text manipulation options
  • It doesn’t have the sexp-based manipulation commands. I couldn’t find standard bindings for these and I’m not up to Emacs tweaking yet. Adding a key for the slime-selector was enough for me at this point.
  • It’s pretty crowded (~100 commands and descriptions on one page)

The Emacs section is weak mainly because I haven’t dived into Emacs the way I have into Lisp/SLIME. I figure for now I can use it as a standard, powerful IDE for writing, testing, and debugging Lisp, and I can add Emacs wizardry later. I think I hit the point of diminishing returns where focusing on my tools will help me learn to code in Lisp. Now I need to get my coding up to par with my tools! I need to improve to the point where it’s worth getting a copy of Learning GNU Emacs.

So without further ado, here is my unfinished yet eminently usable cheat sheet:

[NOTE: These links were broken for a while. They work now]

or customize your own!

Enjoy! As usual, feedback is appreciated. If you’ve got an Emacs trick that you use a jillion times a day that you think a new user could use, this is a great way to share!

Sheet

(PS I hope it goes without saying but there isn’t any kind of beta process. Just that I consider it a work in progress and that it will definitely change in the future, hopefully in response to useful criticism.)

Emacs Lisp Cheat Sheet

Follow the discussion at: Hacker News, programming.reddit.com, comp.lang.lisp, comp.emacs

So on my onward journey to finally learn emacs lisp . I set about the task by creating a simple worksheet of function calls in order to get a better grasp of what is possible with it. The far off goal is to be able to writelanguage modes and be able to integrate with language debuggers.
Lisp Cheat Sheet


;; Elisp Cheat Sheet
;; This is basically an extraction from emacs documentation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;String Functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(stringp 'string') ;;is string ??
(string-or-null-p nil);;t
(char-or-string-p 23) ;;t
(make-string 100 ?*);;'****************************************************************************************************'
(string ?a ?b ?c);;'abc'
(substring 'Hello World' 0 4);;'Hell'
(substring 'Hello World' -5 -1) ;;'Worl'
(substring 'Hello World' -5 nil) ;;'World'
(substring 'Hello World' -5 ) ;;'World'
(substring [a b (c) 'd'] 1 3) ;;[b (c)]
(substring-no-properties 'Hello World' -5 ) ;;disregard text properties.
(concat 'Foo' ' ' 'bar') ;;'Foo bar'
(split-string 'foo:bar:foo' ':') ;; ('foo' 'bar' 'foo')
(split-string 'aooob' 'o*') ;;(' 'a' ' 'b' ')
(char-equal ?x ?x) ;;t
(let ((case-fold-search nil)) ;;nil
(char-equal ?x ?X))
(string= 'abc' 'abc') ;; t
(string< 'a' 'c') ;;t
(format 'str ' t) ;;'str '
(format 'Number %d ' 1) ;;'Number 1 '
(format 'String %s ' 'hellow world') ;;'String hellow world '
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Lists
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;list predicates

Lisp Cheat Sheets

(consp (cdr '(1 2))) ;;t
(consp nil) ;;nil
(atom 1) ;;t
(atom '(1 2)) ;;nil
(listp '(1)) ;; t
(nlistp '(1)) ;;nil
(null '()) ;;t
(null nil) ;;t

;;list access

(car '(a b c)) ;; a
(cdr '(a b c)) ;; (b c)
(cdr '()) ;;nil
(car 1) ;;error
(car-safe 1) ;;nil
(cdr-safe 1) ;;nil
(pop '(a b c))
(nth 0 '(1 2 3)) ;;1
(nthcdr 1 '(1 2 3 4)) ;; (2 3 4)
(last '(1 2 3) 1) ;; 3
(safe-length '(1 2 3)) ;; 3
(caar '((1 2) 3 4)) ;; 1
(cadr '(1 2 3)) ;;2
(cddr '(1 2 3)) ;; (3)
(butlast '(1 2 3 4 5 ) 2) ;; (1 2 3)
(nbutlast '(1 2 3 4 5 ) 2) ;;(1 2 3) desctructive copy.

;; Building Cons Cells and Lists

Sheet

(cons 1 '(2)) ;;(1 2)
(cons 1 2)
(list 1 2 3 4 5 ) ;; (1 2 3 4 5)
(list 1 2 '(1 2) 3 4 5) ;;(1 2 (1 2) 3 4 5)
(make-list 4 1) ;;(1 1 1 1 )
(make-list 0 'pigs) ;; nil
(append '(1 2 3 4) '(5)) ;; (1 2 3 4 5)
(append [a b] 'cd' nil) ;; (a b 99 100)
(apply 'append '((a b c) nil (x y z) nil)) ;; (a b c x y z)
(append) ;; nil
(reverse '(4 3 2 1)) ;; reverse
(number-sequence 0 10 2) ;; (0 2 4 6 8 10)
(number-sequence 9 4 -1) ;; (9 8 7 6 5 4)
;;Modify list variables.
(setq l '(a b))
(push 'c l)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;