















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of lisp (list processing), a programming language and mathematical language used for list processing and manipulation of symbolic information. Discover the flexibility and power of lisp, its recursive nature, and its integration of declarative and procedural knowledge. Learn about lisp notation, functions, and internals.
Typology: Study notes
1 / 23
This page cannot be seen from the preview
Don't miss anything!
















t nil 29 ‘(29 t at) (setq x 4)
x (set ‘x ‘b) x (set x 5) x b (setq c (list x 5 t) )
(car ‘(a b c) ) (car ‘( (a b) c d) ) (cdr ‘(a b c) ) (cdr ‘( (a) (b c) d) ) (cons ‘x ‘(b c) ) (cons ‘(x) ‘(b c) ) (append ‘(c d) ‘(a b) )
(append ‘( (c) ) ‘( (d) ) ) (cadr ‘(a b c) ) (caddar ‘( (a b) (d e) ) ) (cdr ‘(c) ) (cddr ‘(c) ) (car nil)
(min 7 12 -3 9) (mod 12 5) (random 10) (setq a (complex 7 9) ) (imagpart a) (realpart a)
(atom ‘a) (atom ‘(a b) ) (atom 5) (numberp 5) (floatp 5)
(listp 5) (constantp 5) (constanp ‘a) (symbolp ‘a) (symbolp 10) (typep 10 ‘integer) (type-of “hello”)
(equal ‘a ‘a) (equal ‘(a) ‘a) (not nil) (not t) (not ‘a) (null ( ) ) (null 7)
(setq a ‘(a b c) )
(setq b a)
(eq a b)
(equal a b) (setq c ‘(a b c) )
(eq a c) (equal a c) (eval (car a) )
(setq b (cons ‘c (cdr b) ) )
(rplaca a ‘(1 2) )
(rplacd (cdr b) ‘(c d) )
(setf (cadr a) ‘g)
(copy-list ‘( (a) (b) c) )
(list-length ‘(1 3 (4 5) 6 (7 8 9) 10) )
(remove ‘6 ‘(5 6 7 6 (1 6 3) 6) )
(remove-duplicates ‘(5 5 6 7 6 3 9 5) )
(reverse ‘(1 2 (3 4) 5 6) )
(subst 5 6 ‘(6 7 8 (6 5) 4 6) ) (remove ‘(b c) ‘(a (b c) (d e) (b c) ) ) (remove ‘(b c) ‘(a (b c) (d e) (b c) ) :test #’equal)
(defun fname ( parm * [ &optional { parm | ( parm val ) } + ] [ &rest parm ] ) { decl | doc-string } * form * )
(defun dist-from-origin (x y &optional (z 0) ) “computes 3-d distance from origin” (sqrt (+ (* x x) (* y y) (* z z) ) ) )
(dist-from-origin 3 4) (dist-from-origin 3 4 5) (pprint (symbol-function ‘dist-from-origin)) (documentation ‘dist-from-origin ‘function) (defun num-args (&rest alist) (list-length alist) ) (num-args ‘a ‘b ‘(c d) 15 ‘e)
(defun free-function (x) (setq y (* z x) ) (setq z (+ z y) ) )
(setq x ‘(a b c) y ‘(d e) z ‘(f g h) )
(free-function 5)
x
y
z
(load file ) (open file [ :direction ] ) (setq in-file (open “data.lsp” :direction :input) ) (close stream ) (close in-file)
:input:output :io
(rename-file old new )
(delete-file file )
(probe-file file )
(apply ‘append ‘( (1 2 3) ( 4 5 ) ( 6 7 8 ) ) )
(funcall ‘append ‘( 1 2 3 ) ‘( 4 5 ) ‘( 6 7 8 ) )
(mapcar ‘print ‘( a b c ) )
(mapcar ‘1+ ‘( 1 2 3 ) )
(mapcar ‘+ ‘( 1 2 3 ) ‘( 4 5 6 ) ‘( 7 8 ) )
(mapcar ‘print ‘( 1 2 3 ) )
(let ( [ var | ( var value ) ] * ) [ decl ] * [ forms ] * ) LET*
(defun local-fun2 ( x ) (let* ( (y ‘(a b c) (z (cdr y) ) ) (setq y (cons x y) ) (setq z (cons x z) ) ) ) LOOP (loop [ form ] * ) (defun test ( lst ) ( loop (print (car lst) ) (setq lst (cdr lst) ) (when (null lst) (return t) ) ) )