Re: Adding meta data to string?

2009-10-05 Thread Jung Ko
On Sat, Oct 3, 2009 at 7:23 AM, pmf phil.fr...@gmx.de wrote: And String is final, making deriving from it impossible. One way (most probably not the best way) would be to wrap it in a Var and attach the metadata to the Var, i.e. (def #^{:blah :foo} my-string some string) Note that to

Adding meta data to string?

2009-10-03 Thread Jung Ko
) and have the new class implement IObj. However, that solution requires me to program in Java and seems like an overkill for the String class. Is there a better easier way to add meta-data to strings? Sincerely, Jung Ko --~--~-~--~~~---~--~~ You received

Re: Citing clojure

2009-10-02 Thread Jung Ko
On Thu, Oct 1, 2009 at 1:17 PM, John Harrop jharrop...@gmail.com wrote: On Thu, Oct 1, 2009 at 3:42 PM, Dragan Djuric draga...@gmail.com wrote: I usualy cite Rich's conference paper and Stuart's book. @conference{hickey2008clojure, title={{The Clojure programming language}},

re-sub / re-gsub with back-reference?

2009-09-29 Thread Jung Ko
Does anyone know how I can replace a string with back-reference? I'd like something like this: (use clojure.contrib.str-utils) (re-sub #hello (\S+) , how are you \1? hello Jung) = hello, how are you Jung? Basically I need the back reference \1 to evaluate to Jung in the above case. Is there an

Re: re-sub / re-gsub with back-reference?

2009-09-29 Thread Jung Ko
Thank you everyone for the tip. It works great. Using s/replace instead of re-sub makes the code much shorter and easier to read. Thanks, Jung Ko On Tue, Sep 29, 2009 at 8:43 AM, Adrian Cuthbertson adrian.cuthbert...@gmail.com wrote: I was just trying out str-utils2 when Stuart posted

Re: How to override .toString for a struct?

2009-09-22 Thread Jung Ko
-method (:book thebook) writer)) ; falls back to the string writer (print typed-book) ; prints 'somebook' Thank you Mike and Jarkko for the detailed answer. It works as you described. :) Sincerely, Jung Ko --~--~-~--~~~---~--~~ You received this message because you

How to override .toString for a struct?

2009-09-21 Thread Jung Ko
Clojure for only two days): user (defmulti .toString class) user (defmethod .toString clojure.lang.PersistentStructMap [s] (:book s)) Thanks for your help. Regards, Jung Ko --~--~-~--~~~---~--~~ You received this message because you are subscribed