Download |
;
; This contains a few basic operation examples. You can load the
; whole file using
; (load "filename" :print 1)
; but it would probably be more useful to type them in one at a time.
;
; Simple evaluation.
17
'fred
'(4 9 10)
(+ 5 9)
(* 3 (+ 4 9 8) (- 5 8))
;
; Some built-in functions.
(length "hi there")
(length '(a b c 17))
(length '(a b c (4 9 1) 8 1))
(append '(a b c) '(1 2 3))
(car '(2 3 a b c))
(cdr '(hi there tom))
(cons 'yyy '(this is a good day))
;
; Defining things
(setq rumpus 41)
rumpus
(setq zippity (* (+ rumpus 10) 2))
zippity
(defun prodsum (a b c) (* a (+ b c)))
(prodsum 4 9 1)
(prodsum 1 2 3)
(defun 3rd (li) (car (cdr (cdr li))))
(3rd '(Hi there this is Alice))
(3rd '(1 2 3 4 5 6 7 8 9 10))