1 ;; Sample Lisp code, used as a test for clisp-indent.el
2 ;; Contains at least one sample form for every special form or macro.
3 ;; The list is sorted by exporting package.
48 ((*load-pathname
* nil
))
77 (defclass fundamental-stream
78 (stream clos
:standard-object
80 (($open
:type boolean
:initform t
) ; whether the stream is open
81 ($reval
:type boolean
:initform nil
)) ; whether read-eval is allowed
82 (:metaclass standard-class
))
88 (defgeneric foobar
(x y
)
91 (define-condition arithmetic-error
(error)
92 (($operation
:initarg
:operation
:reader arithmetic-error-operation
)
93 ($operands
:initarg
:operands
:reader arithmetic-error-operands
)))
95 (define-modify-macro decf
(x)
99 (define-modify-macro decf
(x) -
102 (define-setf-expander subseq
(seq start end
)
105 (define-setf-method subseq
(seq start end
)
108 (define-symbol-macro *ansi
*
111 (definternational date-format
114 (deflanguage ENGLISH
)
116 (deflocalized date-format ENGLISH
117 "~1{~5@*~D-~4@*~2,'0D-~3@*~2,'0D ~2@*~2,'0D:~1@*~2,'0D:~0@*~2,'0D~:}")
119 (defmacro incf
(place &optional
(delta '1))
120 `(setf ,place
(+ ,place
,delta
)))
122 (defmethod foo ((x integer
)
130 "POSIX Regular Expressions - matching, compiling, executing.")
132 (:export match match-start match-end match-string regexp-quote
133 regexp-compile regexp-exec regexp-split with-loop-split
))
139 (defsetf nth SYSTEM
::%SETNTH
142 (defsetf aref
(array &rest indices
) (value)
143 `(SYSTEM::STORE
,array
,@indices
,value
))
145 (defsetf aref
(array &rest indices
)
147 `(SYSTEM::STORE
,array
,@indices
,value
))
149 (defstruct (control-string-directive
153 (:constructor make-csd
()))
154 (type 0 :type fixnum
)
155 (cs-index 0 :type fixnum
)
156 (parm-list nil
:type list
)
157 (v-or-#-p nil
:type symbol
)
158 (colon-p nil
:type symbol
)
159 (atsign-p nil
:type symbol
)
163 (deftype designator
(thing)
164 (cond ((symbolp thing
)
175 (destructuring-bind (&optional x
198 (do-all-symbols (s (find-package "NAME")
202 (do-external-symbols (s (find-package "NAME")
255 (setf (get blockname
'used
) t
)
256 (do ((L1 *format-uwps
* (cdr L1
))
257 (L2 (get blockname
'uwps
)))
276 (function (lambda (x y
)
283 (function plus
(lambda (x y
)
297 (:method
((x character
))
299 (:method
((x integer
))
303 (generic-function (x)
304 (:method
((x character
))
306 (:method
((x integer
))
309 (generic-labels ((fib (x)
310 (:method
((x (eql 0)))
312 (:method
((x (eql 1)))
314 (:method
((x integer
))
316 (- (fib (+ x
2)) (fib (+ x
1)))
317 (+ (fib (- x
2)) (fib (- x
1)))))))
325 #'(lambda (c) (throw 'exit
(values nil c
))))
327 #'(lambda (c) (throw 'exit
(values nil c
)))))
331 (push-object (part-ref object index
) index
)
333 (format t
"~D does not refer to a selectable part." index
))
334 (:no-error
(&optional x
339 (- (fib (+ x
2)) (fib (+ x
1)))
340 (+ (fib (- x
2)) (fib (- x
1))))
360 (setf (get blockname
'used
) t
)
361 (do ((L1 *format-uwps
* (cdr L1
))
362 (L2 (get blockname
'uwps
)))
396 (macrolet ((Monat->Jahrtag
(Monat) ; 0 <= Monat < 12, 0=März,...,11=Februar
397 `(svref '#(0 31 61 92 122 153 184 214 245 275 306 337) ,Monat
)))
403 (multiple-value-bind (x y
)
407 (multiple-value-call #'%expand-cons
(rest form
)
409 (%expand-list
(cddr form
))
414 (multiple-value-prog1
419 (SM1 SM2 SM3 SM4 SM5
)
420 (get-setf-method (car form
)))
437 (print-unreadable-object (class stream
:type t
)
438 (write (class-classname class
) :stream stream
))
443 (multiple-value-setq (c d
)
452 (multiple-value-setq (c d
)
520 (restart-bind ((nil *fun1
*
521 :interactive-function
*fun2
*
522 :report-function
*fun3
*
523 :test-function
*fun4
*))
529 :interactive-function
*fun2
*
530 :report-function
*fun3
*
531 :test-function
*fun4
*))
536 (invoke-debugger condition
)
537 (continue (&optional x
588 ((x (slot-value obj
'x
))
590 (slot-value obj
'y
)))
593 (symbol-macrolet ((x (slot-value obj
'x
))
595 (slot-value obj
'y
)))
600 (multiple-value-setq (c d
)
651 (with-accessors ((x1 thing-x
) (y1 thing-y
)
656 (with-condition-restarts
661 (with-hash-table-iterator
665 (with-hash-table-iterator (name table
)
668 (with-input-from-string
675 (with-open-file (s "foobar"
679 (with-open-stream (s stream
)
682 (with-output-to-printer (s
683 :external-format charset
:iso-8859-1
)
686 (with-output-to-string (s str
687 :element-type
'character
)
690 (with-package-iterator (name pack
)
694 ((continue (&optional x
698 (invoke-debugger condition
))
705 (with-slots ((x1 x
) (y1 y
)
710 (with-standard-io-syntax
713 (without-floating-point-underflow
725 formatter-bind-terminator
726 formatter-bind-terminators