Programming

(Clojure) Redirecting *out* to JFrame, TextArea, etc.

steloflute 2012. 12. 24. 22:25
https://groups.google.com/forum/?fromgroups=#!topic/clojure/hNyrwx3mYvQ

Redirecting standard out to something.

(def out

  (proxy [java.io.Writer] []
    (close [])
    (flush [])
    (write [thing]
        (. (new javax.swing.JFrame (str "a" thing)) setVisible true))))

(binding [*out* out]
(println "hello"))