tons of small changes to bring this up to date with maxclaims 2.0
[clinton/lisp-on-lines.git] / src / standard-descriptions / list.lisp
1 (in-package :lisp-on-lines)
2
3
4 (define-layered-class list-attribute (standard-attribute)
5 ((item-args :initform nil :initarg :item :layered t :special t)))
6
7 (define-layered-method display-attribute-value
8 ((attribute list-attribute))
9 (generic-format *display* "(")
10 (let ((list (attribute-value attribute)))
11
12 (loop
13 :for cons :on list
14 :do (let ((item (first cons
15 )))
16 (dletf (((attribute-object attribute) item))
17 (apply #'display *display* item (slot-value attribute 'item-args))
18 (unless (endp (cdr cons))
19 (generic-format *display* " "))))))
20 (generic-format *display* ")"))
21
22
23
24
25
26
27 (define-description list ()
28 ((list :attribute-class list-attribute
29 :function #'identity
30 :attributes nil)))
31
32 (define-description cons (list)
33 ((car :label "First" :function #'car)
34 (cdr :label "Rest" :function #'cdr)
35 ))
36
37 (define-description cons ()
38 ((editp :value t :editp nil)
39 (car :setter #'rplaca)
40 (cdr :setter #'rplacd))
41 (:in-description editable))
42
43 (define-description cons ()
44 ((active-attributes :value '(list)))
45 (:in-description inline))
46
47 (define-layered-method description-of ((c cons))
48 (find-description 'cons))
49
50
51
52
53
54