Chouser a écrit :
> On Thu, Oct 9, 2008 at 4:57 PM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>   
>> Go for it.
>>     
>
> (defmethod print-method java.util.regex.Pattern [p #^Writer w]
>   (.write w "#\"")
>   (loop [[#^Character c & r :as s] (seq (.pattern #^java.util.regex.Pattern 
> p))]
>     (when s
>       (cond
>         (= c \\) (do (.append w \\)
>                      (.append w #^Character (first r))
>                      (recur (rest r)))
>         (= c \") (do (.write w "\\\"")
>                      (recur r))
>         :else    (do (.append w c)
>                      (recur r)))))
>   (.append w \"))
>
> --Chouser
>   
Hello Chouser, (btw, nice work you are doing with ClojureScript)

Do you plan to support printing of all Pattern instances or only those 
created using the new literal syntax? In the first case, the story gets 
more complex with \Q, \E and flags. In the second case, that's fine.

Christophe


--~--~---------~--~----~------------~-------~--~----~
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