When calling a function that returns something the REPL prints the output. How to suppress this printing without resorting to temporarily adding nil
as the last line in a function?
This is fairly easy to do. If, for instance, you have a function named f
, then as you know, you can call it like this:
(f)
;; hello yes this is f
;;=> :huge
But if you want to ignore the output, you can do this instead:
(do (f) nil)
;; hello yes this is f
;;=> nil
You could also define an ignore
function to do this for you if you feel like it:
(def ignore (constantly nil))
(ignore (f))
;; hello yes this is f
;;=> nil
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With