clerk

phronmophobic 2024-02-01T18:09:03.377359Z

I was trying to set things up so that all results are shown except for the results from defn, but couldn't figure it out. More info in 🧡

phronmophobic 2024-02-01T18:10:36.177199Z

Here's what I tried:

(def var-viewer
  {:pred (fn [o]
           (or (var? o)
               (fn? o)))
   :transform-fn (fn [_]
                   nil)})

(clerk/reset-viewers!
 (into [var-viewer]
       (remove #{v/var-viewer
                 v/var-from-def-viewer})
       v/default-viewers))

{:nextjournal.clerk/visibility {:code :hide :result :show}}

(defn my-fn [])

(+ 1 2)
The goal is for 3 to show up for the (+ 1 2) expression, but to prevent #function[wikiart/my-fn] from showing up for (defn my-fn []).

mkvlr 2024-02-01T18:31:06.586429Z

with the latest version on main the example at the bottom of https://github.com/nextjournal/clerk/blob/main/notebooks/viewers/context.clj should work

πŸ‘ 1
πŸ‘€ 1
phronmophobic 2024-02-01T18:33:44.857389Z

I have a workaround so I'll probably stick with that until an official release. I just wanted to check to see if I was doing something dumb.

mkvlr 2024-02-01T18:34:50.807909Z

yeah it’s still cutting edge and undocumented since we’re not happy with the naming yet

πŸ‘ 1