Return to Snippet

Revision: 4604
at January 13, 2008 13:09 by darkphotn


Updated Code
(print 'hi)

(print "hello world")

(defun f(x)
   (cond ((null x) 'null)
         ('T 'not-null) ) )

(f 'blah)

(f NIL)

(defun g()
   (print 'hi)
   (print 'bye) )

(g)

(setq x 5)

(equal x 5)

(print x)

(print 'x)

(+ '5 '3)

(if 'T 1 2)

(if NIL 1 2)

(and 'T 'T)

(or 'T NIL)

(if (and 'T 'T) 1 2)

(car '(1 2 3 4 5))

(cdr '(1 2 3 4 5))

Revision: 4603
at January 13, 2008 13:01 by darkphotn


Updated Code
(print 'hi)

(print "hello world")

(defun f(x)
   (cond ((null x) 'null)
         ('T 'not-null) ) )

(f 'blah)

(f NIL)

(defun g()
   (print 'hi)
   (print 'bye) )

(g)

(setq x 5)

(equal x 5)

(+ '5 '3)

(if 'T 1 2)

(if NIL 1 2)

(and 'T 'T)

(or 'T NIL)

(if (and 'T 'T) 1 2)

Revision: 4602
at January 13, 2008 12:55 by darkphotn


Initial Code
(print 'hi)

(print "hello world")

(defun f(x)
   (cond ((null x) 'null)
         ('T 'not-null) ) )

(f 'blah)

(f NIL)

(setq x 5)

(equal x 5)

(+ '5 '3)

(if 'T 1 2)

(if NIL 1 2)

(and 'T 'T)

(or 'T NIL)

(if (and 'T 'T) 1 2)

Initial URL


Initial Description
This demonstrates, in as few lines as possible, the basic syntax of LISP.  You should be able to figure out how to make more complex programs just by thinking about it.  For example, if (+ '1 '2) is how you add numbers, then (* '1 '2) would multiply numbers.  String them together for more complexity --- (* (+ '1 '2) (+ '3 '4)).  Note that, with numbers, you can use '1 or 1 -- it's basically the same thing.  With variables, it is different.  Designed using CLISP.

Initial Title
Simple LISP reference

Initial Tags


Initial Language
Lisp