This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1,13 @@
;; An empty lambda list () takes 0 parameters.
(defun 0args ()
(format t "Called 0args~%"))
;; This lambda list (a b) takes 2 parameters.
(defun 2args (a b)
(format t "Called 2args with ~A and ~A~%" a b))
;; Local variables from lambda lists may have declarations.
;; This function takes 2 arguments, which must be integers.
(defun 2ints (i j)
(declare (type integer i j))
(/ (+ i j) 2))

View file

@ -0,0 +1,8 @@
;; Rest parameter, for variadic functions: r is a list of arguments.
(a b &rest r)
;; Optional parameter: i defaults to 3, (f 1 2) is same as (f 1 2 3).
(a b &optional (i 3))
;; Keyword parameters: (f 1 2 :c 3 :d 4) is same as (f 1 2 :d 4 :c 3).
(a b &key c d)