Fork me on GitHub
#clojurescript
<
2023-11-07
>
hanDerPeder22:11:34

think I remember something akin to (set! *warn-on-reflection* true) , but it outputs forms as javascript on the repl. is that a thing?

dpsutton22:11:01

cljs.user=> (doc *print-fn-bodies*)
-------------------------
cljs.core/*print-fn-bodies*
  *print-fns-bodies* controls whether functions print their source or
    only their names.

nil
cljs.user=> (set! *print-fn-bodies* true)
true

dpsutton22:11:19

and then

cljs.user=> (defn foo [x] (cond (even? x) (inc x) (odd? x) (dec x)))
#'cljs.user/foo
cljs.user=> foo
#object[cljs$user$foo "function cljs$user$foo(x){
if(cljs.core.even_QMARK_.call(null,x)){
return (x + (1));
} else {
if(cljs.core.odd_QMARK_.call(null,x)){
return (x - (1));
} else {
return null;
}
}
}"]

p-himik22:11:41

But you can also just (println (str foo)).

hanDerPeder22:11:15

that's it! thanks!