Guest User

Proxying InputStream (part 2)

a guest
May 9th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (require '[clojure.java.io :as io])
  2.  
  3. (defn ff []
  4.   (let [p (let [count (atom 0)]
  5.             (proxy [java.io.InputStream] []
  6.               (read []
  7.                 (if (< (swap! count inc) 10)
  8.                   \a
  9.                   -1))))
  10.         sq (line-seq (io/reader p))]
  11.     (doseq [v sq]
  12.       (println v))))
Add Comment
Please, Sign In to add comment