4358148e |
1 | (in-package :lisp-on-lines) |
2 | |
2548f054 |
3 | |
eeed4326 |
4 | (define-layered-class list-attribute (define-description-attribute) |
2548f054 |
5 | ((item-args :initform nil :initarg :item :layered t :special t))) |
6 | |
7 | (define-layered-method display-attribute-value |
8 | ((attribute list-attribute)) |
46440824 |
9 | (generic-format *display* "(") |
10 | (let ((list (attribute-value attribute))) |
11 | |
12 | (loop |
13 | :for cons :on list |
14 | :do (let ((item (first cons |
f56d6e7e |
15 | ))) |
46440824 |
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 | |
2548f054 |
26 | |
27 | (define-description list () |
28 | ((list :attribute-class list-attribute |
29 | :function #'identity |
30 | :attributes nil))) |
31 | |
32 | (define-description cons (list) |
4358148e |
33 | ((car :label "First" :function #'car) |
2548f054 |
34 | (cdr :label "Rest" :function #'cdr) |
35 | )) |
4358148e |
36 | |
37 | (define-description cons () |
38 | ((editp :value t :editp nil) |
39 | (car :setter #'rplaca) |
40 | (cdr :setter #'rplacd)) |
41 | (:in-description editable)) |
42 | |
2548f054 |
43 | (define-description cons () |
44 | ((active-attributes :value '(list))) |
45 | (:in-description inline)) |
46 | |
4358148e |
47 | (define-layered-method description-of ((c cons)) |
48 | (find-description 'cons)) |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |