Looking at the clojure.main/repl code, I can see that they print the result
value to stdout, and that I can change that by assigning a different function
to the :print option at repl-startup.
It's a little tricky, but that does allow me to turn the printing of results
on/off, which would give m
> Yes - I do get the result of the print function in the repl (i.e. nil), and
> I'm trying to see how I can somehow prevent that nil from printing to stdout.
Yeah, the point I was making is that you are always going to see that
'nil' printed at the repl because it always evaluates and prints the
Yes - I do get the result of the print function in the repl (i.e. nil), and I'm
trying to see how I can somehow prevent that nil from printing to stdout.
I understand that you do not see any nil's in your example as you stay inside
of your loop and there is no result only side effects.
(which is
are you sure you're not just seeing the result of the function call in
the repl? for example this:
(ns filter.core
(:require [clojure.string :as string])
(:gen-class))
(defn -main
[& args]
(loop []
(when-let [line (read-line)]
(println (string/upper-case line))
(recur
I'm trying to write some filters in clojure from stdin to stdout, but I have
this nil at the end of the stream, which is what print returns.
As an alternative, I can return strings, but then I have the surrounding "s.
Or I could end by printing (symbol ""), like (do (print "hi")(symbol "")) whic