Rich,

This is code from my socket repl that sparked my interest in support  
for destructuring in clojure/binding.

(defn socket-streams     ;; returns a vector of 3 streams
   [s]
   [(LineNumberingPushbackReader. (InputStreamReader. (.getInputStream  
s) "UTF-8"))
    (OutputStreamWriter. (.getOutputStream s) "UTF-8")
    (PrintWriter. (OutputStreamWriter. (.getOutputStream s) "UTF-8")   
true)])

(defn socket-repl        ;; accepts a vector of 3 streams with minimal  
fuss
   "Starts a repl thread on the iostreams of supplied socket"
   [s]
   (on-thread
    #(binding [[*in* *out* *err*] (socket-streams s)] (SocketRepl/ 
repl))))

I've updated the patch I posted previously. I think this  
implementation is very readable and a nice example of how much  
destructuring, metadata, and reader support for a variety of  
collections can contribute to making Clojure code more clear and  
compact.

        http://clojure.googlegroups.com/web/destructuring-binding.patch

Please consider including it in Clojure.

Thanks,

--Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to