 
 (defn execute-with-client [client options form]
   (let [command-id (nrepl.misc/uuid)
-        response-seq (nrepl/message client {:op "eval" :code form :id command-id :session @current-session})]
+        session (or (:session options) @current-session)
+        response-seq (nrepl/message client {:op "eval" :code form :id command-id :session session})]
     (reset! current-command-id command-id)
     (doall (for [{:keys [ns value out err] :as res}
                    (take-while #(not (some #{"done" "interrupted" "error"} (:status %)))

                 (:host options "localhost"))]
    (nrepl/connect :host host :port port)))

(defn adhoc-eval [client form]
  (let [results (atom "nil")]
    (execute-with-client
      client
      {:value (partial reset! results)
       :out print
       :err print}
      (pr-str form))
    (read-string @results)))


          (let [input-result (.readLine *in*)]
            (nrepl/message client
              {:op "stdin" :stdin (str input-result "\n")
               :id (nrepl.misc/uuid) :session session})))
        (when value ((:value options print) value))
        (when out ((:out options print) out))
        (when err ((:err options print) err))
