This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-07
Channels
- # aleph (3)
- # aws (7)
- # beginners (117)
- # boot (119)
- # cider (2)
- # cljs-dev (3)
- # clojure (193)
- # clojure-austin (1)
- # clojure-dusseldorf (4)
- # clojure-finland (5)
- # clojure-france (5)
- # clojure-italy (7)
- # clojure-portugal (1)
- # clojure-russia (204)
- # clojure-serbia (5)
- # clojure-spec (31)
- # clojure-uk (64)
- # clojurescript (288)
- # community-development (9)
- # core-async (54)
- # cursive (8)
- # datascript (18)
- # datomic (26)
- # dirac (8)
- # emacs (26)
- # figwheel (1)
- # hoplon (16)
- # jobs (2)
- # jobs-discuss (4)
- # juxt (1)
- # lein-figwheel (4)
- # leiningen (14)
- # london-clojurians (2)
- # lumo (17)
- # off-topic (44)
- # om (63)
- # om-next (2)
- # onyx (26)
- # perun (14)
- # planck (5)
- # portland-or (34)
- # proton (2)
- # protorepl (8)
- # quil (1)
- # re-frame (6)
- # reagent (16)
- # remote-jobs (4)
- # ring (7)
- # ring-swagger (10)
- # rum (1)
- # untangled (2)
@thedavidmeister In your debugging function (defn prnr [v] (prn v) v)
what does the last v
do?
returns v
instead of nil
prn
returns nil
@chromalchemy makes it easier to chain
(-> a foo bar prnr baz)
Oh, ok, I see now. Thanks
I've never gotten comfortable with a standard repl, and followed Micha's advice to just use reload+console. Make sense cause all your namespaces and state are already loaded.
But i found myself restructuring my code a lot just to test and experiment with values
Came up with this to try and keep the repl-ish testing separate from my "canonical" code, (but I dont think it really does much :thinking_face:)
(defelem eval
[{:keys [clear?] :as attr}]
(let [exprs (dissoc attr :x)]
(div
:clear-console?
(if (nil? clear?) (.clear js/console))
:print-expression-name-and-value
(for [fn-vec (into [] exprs)]
(do (.log js/console (title-string-fn (first fn-vec)))
(.log js/console (second fn-vec)))))))
(eval :fn1-title (fn1) :fn2-title (fn2) ;;; etc...
(cell= (eval :clear? true :fn-title (myfn)))
Keeps refreshing the printout in place in the console. Helpful when testing time or ui based dynamic data (cells).I wanted to print out the actual function code to, to see everthing in one glance in the console. But I couldn't figure out how to execute a function, and print the forms of that function as a side effect (if it's even possible)
@chromalchemy ok so...
i think the way i approach things is different
i've tried to make it so restructuring code to test/experiment with values is A Good Thing
then i use automated tests and a library of "patterns", which is basically just a bunch of example values in a GUI, to make sure things work properly