What is the idiomatic way to print values ββinside a binding let?
When I started developing in Clojure, I wrote code in REPL, and then I turned into simple expressions let. As a newbie, I often made mistakes during this (simple) phase of transformation.
(let [a (aFn ...)
b (bFn ... a)]
;; error above
)
So, I would turn it into something similar, basically an attachment:
(println "a is" (aFn ...))
(println "b is" (bFn ... (aFn ...)))
(let [a (aFn ...)
b (bFn ... a)]
;; ...
)
It works most of the time thanks to Clojure good (immutability, referential transparency ..).
Now I am doing something line by line:
(let [a (aFn ...)
_ (println "a is" a)
b (bFn ... a)
_ (println "b is" b)]
;; ...
)
This is an improvement, but it still seems awkward. What is the right way to do this?
source
share