Hangman - my first Clojure code
A bunch of random observations


avoid def as a non-top level form e.g. in (def the-guess (atom "")), prefer let bindings
there's no need to use a ref for the connection, as it never changes after creation. Prefer a simple map, which also enables you to use plain destructuring instead of using let to extract its components:


&nbsp;

(defn conn-handler [{:keys [in out] :as conn}] ...)
...
conn {:in in :out out}]
(println "Client connected")
(doto (Thread. #(conn-handler conn)) (.start))



instead of using interop to interact with the in/out streams you could use a more idiomatic (binding [*out* out *in* in] (println ...) (read-line))
you loop over the conn, but you always recur over the very same object. You can remove conn from the loop/recur forms
if you follow the binding approach as described above, but within the anonymous function that you use to initialize the thread, you could completely remove the conn name from the whole code:


&nbsp;

(defn conn-handler [] (println "...") ...)

(doto (Thread. #(binding [*in* in *out* out] (conn-handler)) (.start))



there's no need to use an atom for the guess, just use plain recursion:


&nbsp;

(loop [the-guess ""]
...
  (recur g))


The following code contains the revised conn-handler and -main functions, including all the suggestions above, plus the cosmetic change of using the threading macro -&gt; instead of the doto form, which seems a bit clearer:

(defn conn-handler []
  (println "Welcome to this simple hangman game.")
  (loop [the-guess ""]
    (println (str "Guess the word: " (guess the-guess word)))
    (flush)                                                                                       
    (let [g (str the-guess (readLine))                                                            
          res (guess g word)]                                                                          
      (if (= word res)                                                                                 
        (do                                                                                            
          (println res)                                                                           
          (println "Correct!")                                                                    
          (flush))                                                                                
        (do                                                                                            
          (recur g))))))                                                                           

(defn -main [&amp; args]                                                                                     
  (println "Server running…")                                                                         
  (with-open [server (listen 3456)]                                                                      
    (while true                                                                                             
      (let [client (.accept server)                                                                      
            in (BufferedReader.(InputStreamReader.(.getInputStream client)))                               
            out (PrintWriter. (.getOutputStream client))]                                                                  
        (println "Client connected")                                                                     
        (-&gt; #(binding [*in*  in
                       *out* out]
               conn-handler)
            (Thread.)
            (.start))))))