title: racket to-string function for integer and string
body: <p>Need to write a <code>to-string</code> function that accepts integer and string.</p>
  
  <pre><code>(to-string 3) ; -&gt; "3"
  (to-string "hello") ; -&gt; "\"hello\""
  (to-string "hel\"lo") ; -&gt; "\"hel\\\"lo\""
  </code></pre>
  
  <p>I managed to do so with:</p>
  
  <pre><code>(define (to-string x)
    (define o (open-output-string))
    (write x o)
    (define str (get-output-string o))
    (get-output-bytes o #t)
    str
    )
  (to-string 3)
  (to-string "hello")
  (to-string "hel\"lo")
  </code></pre>
  
  <p>However, the <code>get-output-bytes</code> reseting is not very readable. What's the idiomatic Racket way of doing it?</p>