This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-23
Channels
- # babashka (2)
- # babashka-sci-dev (401)
- # beginners (10)
- # biff (6)
- # calva (6)
- # clj-on-windows (6)
- # cljfx (13)
- # clojure (91)
- # clojure-austin (1)
- # clojure-europe (6)
- # clojure-norway (11)
- # clojurescript (14)
- # clr (3)
- # docker (3)
- # emacs (2)
- # fulcro (21)
- # hyperfiddle (2)
- # membrane (30)
- # nbb (4)
- # pedestal (7)
- # polylith (16)
- # reitit (1)
- # sci (4)
- # xtdb (9)
Hello! How do I avoid call unbound fn: #'clojure.core/*print-fn*
? I evaluate code in cljs repl, the following works fine:
(println :i-fail)
; OUT: :i-fail
; => nil
but when I do the same via sci, it fails:
(sci/eval-string* (sci/init {}) "(println :i-fail)")
; Execution error (Error) at (<cljs repl>:1).
; Attempting to call unbound fn: #'clojure.core/*print-fn*
I tried to add (enable-console-print!)
to the code I send to SCI for eval, but of course this var is not known at that point.
I must be doing something wrong, but what?✅ 1
It’s in the SCi README, sorry for the brief response but traveling, look for alter var root sci out err
You answer was perfect! I should have checked the readme… For posterity: I have added this to my cljs ns, where I invoke sci from:
(enable-console-print!)
(sci/alter-var-root sci/print-fn (constantly *print-fn*))
(sci/alter-var-root sci/print-err-fn (constantly *print-err-fn*))
A tiny attempt at improving the readme for lazy ppl https://github.com/babashka/sci/pull/900/files