1 (defun pr-str (form &optional print-readably
)
2 (let ((type (mal-type form
))
3 (value (mal-value form
)))
12 (number-to-string (mal-value form
)))
15 (let ((print-escape-newlines t
))
16 (prin1-to-string value
))
18 ((or (eq type
'symbol
) (eq type
'keyword
))
21 (pr-list value print-readably
))
23 (pr-vector value print-readably
))
25 (pr-map value print-readably
))
31 (format "(atom %s)" (mal-value value
))))))
33 (defun pr-list (form print-readably
)
34 (let ((items (mapconcat
35 (lambda (item) (pr-str item print-readably
))
37 (concat "(" items
")")))
39 (defun pr-vector (form print-readably
)
40 (let ((items (mapconcat
41 (lambda (item) (pr-str item print-readably
))
42 (append form nil
) " ")))
43 (concat "[" items
"]")))
45 (defun pr-map (form print-readably
)
49 (push (cons (pr-str key print-readably
)
50 (pr-str value print-readably
))
53 (let ((items (mapconcat
54 (lambda (item) (concat (car item
) " " (cdr item
)))
55 (nreverse pairs
) " ")))
56 (concat "{" items
"}"))))