store/[org.clojure/clojure "1.8.0"] clj::clojure.core/with-in-str

Official Documentation

Add notes
Arities
==================================================
   [s & body]

Docstring
==================================================
  Evaluates body in a context in which *in* is bound to a fresh
  StringReader initialized with the string s.

Source

(defmacro with-in-str
  "Evaluates body in a context in which *in* is bound to a fresh
  StringReader initialized with the string s."
  {:added "1.0"}
  [s & body]
  `(with-open [s# (-> (java.io.StringReader. ~s) clojure.lang.LineNumberingPushbackReader.)]
     (binding [*in* s#]
       ~@body)))

Example 1

Edit
;; Given you have a function that will read from *in*
(defn prompt [question]
  (println question)
  (read-line))

(prompt "How old are you?")
;; > How old are you?
;; < 34                   ; <== This is what you enter
;; => "34"                 ; <== This is returned by the function

;; You can now simulate entering your age at the prompt by using with-in-str

(with-in-str "34" (prompt "How old are you?"))
;; > How old are you?
;; => "34"                 ; <== The function now returns immediately 

Uses on crossclj