19 lines
426 B
Common Lisp
19 lines
426 B
Common Lisp
(+ 2.5 3.1)
|
|
(defun fib (n)
|
|
(if (< n 2)
|
|
1
|
|
(+ (fib (- n 2)) (fib (- n 1)))))
|
|
(fib 10)
|
|
(defun ! (x) (if (equal x 0) 1 (* x (! (- x 1)))))
|
|
(! 7)
|
|
(defun fn1 (fn) (+ (fn 1 2) (fn 3 4)))
|
|
(defun fn2 (a b) (+ a b))
|
|
(fn1 (function +))
|
|
(fn1 (function fn2))
|
|
(fn1 (function (lambda (z1 z2) (+ z1 z2))))
|
|
(quote a)
|
|
(cons (quote (a b)) (quote (c d e)))
|
|
(cons (quote (f)) ())
|
|
(car (quote (a b c)))
|
|
(cdr (cdr (quote (g h i))))
|