Re: toUpperCase on java.lang.String

2008-10-16 Thread Parth Malwankar
On Oct 16, 4:29 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 15, 11:47 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > > > > > Hi Parth, > > > > But if I do this in a doto, it doesn't seem to work but > > > I don't get any error message. > > > > user=> (doto (new java.lang.String "h

Re: toUpperCase on java.lang.String

2008-10-16 Thread Stephen C. Gilardi
On Oct 16, 2008, at 7:29 AM, Rich Hickey wrote: > Another semantic marker here is 'do'. do in Clojure implies side- > effects. Since you can't uppercase a string by side effect, doto isn't > the right tool for this job. Neat. I explored the "do..." marker a little with Clojure: - user

Re: toUpperCase on java.lang.String

2008-10-16 Thread Rich Hickey
On Oct 15, 11:47 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Hi Parth, > > > But if I do this in a doto, it doesn't seem to work but > > I don't get any error message. > > > user=> (doto (new java.lang.String "hello") (toUpperCase)) > > "hello" > > user=> (class (new java.lang.String))

Re: toUpperCase on java.lang.String

2008-10-16 Thread Timothy Pratley
Thanks! --~--~-~--~~~---~--~~ 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,

Re: toUpperCase on java.lang.String

2008-10-16 Thread mb
Hi, On 16 Okt., 08:17, Timothy Pratley <[EMAIL PROTECTED]> wrote: > What does 'mix in non-methods' means? I read the (doc ->) but I really > don't follow that explination. -> is more general than .. . .. only works on objects. (.. foo (bar baz) (frob nicate)) is equivalent to (. (. foo ba

Re: toUpperCase on java.lang.String

2008-10-15 Thread Timothy Pratley
Oh wow, powerful syntax! > user=> (-> "hello" .toUpperCase (.replace "H" "J")) > "JELLO" > .. would also work, but I pretty much always prefer -> because you can > mix in non-methods, and the methods are clearly indicated with a > leading dot.  In fact, I could imagine lobbying to have .. remove

Re: toUpperCase on java.lang.String

2008-10-15 Thread Stephen C. Gilardi
Hi Parth, > But if I do this in a doto, it doesn't seem to work but > I don't get any error message. > > user=> (doto (new java.lang.String "hello") (toUpperCase)) > "hello" > user=> (class (new java.lang.String)) > #=java.lang.String > > Shouldn't this be working? If this is (by design) because

Re: toUpperCase on java.lang.String

2008-10-15 Thread Chouser
On Wed, Oct 15, 2008 at 11:20 PM, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > But if I do this in a doto, it doesn't seem to work but > I don't get any error message. > > user=> (doto (new java.lang.String "hello") (toUpperCase)) > "hello" > user=> (class (new java.lang.String)) > #=java.lang.S

toUpperCase on java.lang.String

2008-10-15 Thread Parth Malwankar
Calling a java method on a string directly works. user=> (.toUpperCase "hello") "HELLO" user=> (class "hello") #=java.lang.String But if I do this in a doto, it doesn't seem to work but I don't get any error message. user=> (doto (new java.lang.String "hello") (toUpperCase)) "hello" user=> (cla