title: IllegalArgumentException when writing bytes to file
body: <pre><code>(ns huffman.core
    (:use [clojure.java.io :only [output-stream]]))
  
  (defn use-output-stream-1 []
    (with-open [o (output-stream path)]
      (.write o (unchecked-byte 255))
      (.write o (unchecked-byte (Integer/parseInt "01010101" 2)))
      ))
  
  (defn rb [b]
    (unchecked-byte (Integer/parseInt b 2)))
  
  (defn use-output-stream-2 []
    (with-open [o (output-stream path)]
      (.write o (unchecked-byte 255))
      (.write o (rb "01010101"))
      ))
  </code></pre>
  
  <p><code>use-output-stream-1</code> works as expected and the written file has been verified. I do not understand by <code>use-output-stream-2</code> throws an error. </p>
  
  <pre><code>huffman.core&gt; (use-output-stream-1)
  nil
  huffman.core&gt; (rb "01010101")
  85
  huffman.core&gt; (use-output-stream-2)
  IllegalArgumentException No matching method found: write for class java.io.BufferedOutputStream  clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
  huffman.core&gt; 
  </code></pre>
  
  <p><strong>EDIT</strong>. I assumed that this is something to do with evaluation order so I wrote a macro.</p>
  
  <pre><code>(defmacro rb-macro [b]
    `(unchecked-byte (Integer/parseInt ~b 2)))
  
  (defn use-output-stream-3 []
    (with-open [o (output-stream path)]
      (.write o (unchecked-byte 255))
      (.write o (rb-macro "01010101"))
      ))
  </code></pre>
  
  <p>This seems to solve the problem, but I would like to understand what is going on. I don't see why <code>(rb "01010101")</code> is not first evaluated and then the result passed to <code>.write</code></p>