-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.lisp
43 lines (37 loc) · 1.14 KB
/
api.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(in-package :kdl)
(defun value (value)
(car value))
(defmethod (setf value) (new-value value)
(setf (car value) new-value))
(defun value-type (value)
(cdr value))
(defmethod (setf value-type) (new-type value)
(setf (cdr value) new-type))
(defun property-name (property)
(car property))
(defmethod (setf property-name) (new-name property)
(setf (car property) new-name))
(defun property-value (property)
(value (cdr property)))
(defmethod (setf property-value) (new-value property)
(setf (value (cdr property)) new-value))
(defun property-type (property)
(value-type (cdr property)))
(defmethod (setf property-type) (new-value property)
(setf (value-type (cdr property)) new-value))
(defun node-name (node)
(first node))
(defmethod (setf node-name) (new-name node)
(setf (first node) new-name))
(defun node-properties (node)
(second node))
(defun node-children (node)
(third node))
(defun node-child (node n)
(nth n node))
(defmethod (setf node-child) (new-child node n)
(setf (nth n node) new-child))
(defun node-type (node)
(first (last node)))
(defmethod (setf node-type) (new-type node)
(setf (first (last node)) new-type))