the https://github.com/clojure-emacs/orchard/blob/master/doc/inspector.org is still talking about inspect/fresh which seems to be deprecated for awhile.
so i was wondering how can i use orchard.inspect directly from a streaming REPL, but i can't find what is the equivalent of (inspect/inspect-print Boolean) on the latest orchard version.
is there an equivalent still to print the :rendered key of an inspector as plain text or ansi-colored text?
Hi! The inspector docs in the Orchard namespaces haven't been updated for a while, that's true. And I recently removed the inspect-print function indeed. But you can put ship it with your code given how basic it is, and you'll probably want to customize it too, so it will be easier for you to keep it on your side.
i see.
it's a very useful function though, since it enabled providing REPL-based example outputs in the https://github.com/clojure-emacs/orchard/blob/master/doc/inspector.org, so at least it should be included into that doc, given how simple is it.
while it's simple, it's not trivial, until someone familiarizes themselves with the semantics of a :rendered value.
I was planning to scrap those docs and write an extended documentation for the CIDER inspector. inspect-print purpose was primarily for these docs, and I think it overstayed its welcome. It is not maintained in the sense that the changes to the inspector are made without the regard to how inspect-print output will look like. Certain interactive things like paging don't make sense for that function too. So, I think if somebody was to make an alternative display for the :rendered data, it needs to be done from scratch.
according to claude code:
⏺ The inspect-print function was removed in commit a240648 ("Refactor"). Looking at the current code, there isn't a direct equivalent, but you can achieve similar
functionality by:
1. Creating a simple converter for the rendered output:
(defn rendered->string [rendered]
(apply str
(map (fn [item]
(cond
(= item '(:newline)) "\n"
(string? item) item
(and (seq? item) (= (first item) :value))
(second item)
:else ""))
rendered)))
;; Usage:
(-> (inspect/start your-value)
:rendered
rendered->string
println)
2. Or use the test helper function from test/orchard/inspect_test.clj:108-115:
(defn render [inspector]
(reduce (fn [acc x]
(let [lst (peek acc)]
(if (and (string? x) (string? lst))
(conj (pop acc) (str lst x))
(conj acc x))))
[] (:rendered inspector)))
The inspect-print function was removed as part of refactoring, but the core functionality remains - you just need to process the :rendered field yourself to convert the
instructions into a printable string.is this a fair assessment?
btw, the original implementation was this: https://github.com/clojure-emacs/orchard/blob/e692cbe89647f1721cc7b0e091340029bc8d1cd5/src/orchard/inspect.clj#L1137-L1146 interesting how claude re-jigged it to something different, without even asking for it
the reason im looking into this, is because i wanted to just understand what does the orchard package offer, but im still living in cursive most of the time, where i just have a traditional streaming repl