1. If Clerk was written in Common Lisp, would objects provide their own Clerk viewer?
2. Is the idea of keeping viewers and objects with selected viewer as a map (attached code) to provide a way for objects to provide their own Clerk viewer (attached screenshot)?
3. Are you trying to hint towards that developers should
a. Prefer immutable data (“just use maps” / “it’s just data”)
b. Put their own data into the map under their own keys
c. (optionally) also provide Clerk helpers
i. by giving a :nextjournal/value and a :nextjournal/viewer key
ii. optionally using structural sharing to avoid duplicate in-memory use for a duplicated :nextjournal/value value that also might occur somewhere else in the map
d. and (optionally) also register a default viewer for their own types with clerk/add-viewer!
e. ?
(v/with-viewer v/string-viewer "hello")
;; => #:nextjournal{:value "hello",
;; :viewer
;; {:name nextjournal.clerk.viewer/string-viewer,
;; :pred #function[clojure.core/string?--5475],
;; :render-fn nextjournal.clerk.render/render-quoted-string,
;; :opening-paren "\"",
;; :closing-paren "\"",
;; :page-size 80}}
On a different note, I hope everyone enjoys a lovely ☀️ Sunday ☀️!