Skip to content

Commit

Permalink
pprint
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Oct 21, 2024
1 parent bfb838a commit ed82650
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions notebooks/viewers/viewer_lib.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
[foo.bar :as-alias foo]
[cljs.core :as c]
[clojure.math :as math1]
[cljs.math :as math2])))
[cljs.math :as math2]
[clojure.pprint :as pp])))

#?(:cljs `foo/x)

#?(:cljs (defn my-already-defined-function [x]
[:div
"Inspected value :)"
(str (cljs.core/inc (math2/floor (math1/floor 1.2))))
[:div [clerk/inspect x]]]))
[:div [clerk/inspect x]]
[:div (with-out-str (pp/pprint (range 20)))]]))
2 changes: 1 addition & 1 deletion render/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
org.clojure/clojurescript {:mvn/version "1.11.132"}
io.github.babashka/sci.nrepl {:mvn/version "0.0.2"}
reagent/reagent {:mvn/version "1.2.0"}
io.github.babashka/sci.configs {:git/sha "0702ea5a21ad92e6d7cca6d36de84271083ea68f"
io.github.babashka/sci.configs {:git/sha "8253c69a537bcc82e8ff122e5f905fe9d1e303f0"
:exclusions [org.babashka/sci]}
io.github.nextjournal/clojure-mode {:git/sha "1f55406087814a0dda6806396aa596dbe13ea302"}
thheller/shadow-cljs {:mvn/version "2.23.1"}
Expand Down
4 changes: 3 additions & 1 deletion src/nextjournal/clerk/cljs_libs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
reagent.core
reagent.debug
reagent.ratom
user}))
user
clojure.pprint
cljs.pprint}))

(defn- ns-decl?
"Returns true if form is a (ns ...) declaration."
Expand Down
7 changes: 5 additions & 2 deletions src/nextjournal/clerk/sci_env.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
[reagent.ratom :as ratom]
[sci.configs.applied-science.js-interop :as sci.configs.js-interop]
[sci.configs.reagent.reagent :as sci.configs.reagent]
[sci.configs.cljs.pprint :as sci.configs.pprint]
[sci.core :as sci]
[sci.ctx-store]
[sci.nrepl.server :as nrepl]
Expand Down Expand Up @@ -162,7 +163,8 @@
"react-dom" react-dom
"w3c-keyname" w3c-keyname}
:ns-aliases '{clojure.math cljs.math
cljs.repl clojure.repl}
cljs.repl clojure.repl
clojure.pprint cljs.pprint}
:namespaces (merge {'nextjournal.clerk.viewer viewer-namespace
'nextjournal.clerk viewer-namespace ;; TODO: expose cljs variant of `nextjournal.clerk` with docstrings
'nextjournal.clerk.sci-env {'load-string+
Expand Down Expand Up @@ -191,7 +193,8 @@
'nextjournal.markdown.transform)

sci.configs.js-interop/namespaces
sci.configs.reagent/namespaces)})
sci.configs.reagent/namespaces
sci.configs.pprint/namespaces)})

(defn ^:export eval-form [f]
(sci/binding [sci/ns @last-ns]
Expand Down

0 comments on commit ed82650

Please sign in to comment.