Re: Modified doto

2008-11-19 Thread Rich Hickey
On Oct 23, 9:53 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote: > > > Hi, > > > On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto-> > > > The name is actually also up to discussion. doto is already > > in use and this change is incom

Re: Modified doto

2008-10-27 Thread mac
On Oct 25, 10:27 am, "V.Quixote" <[EMAIL PROTECTED]> wrote: > I'd like some version of doto that works on bare Classes (defmacro sdoto "Version of doto for use with static methods" [x & methods] `(do ~@(map (fn [m] (list '. x m)) methods) ~x)) Here you go. sdoto for

Re: Modified doto

2008-10-25 Thread V.Quixote
I'd like some version of doto that works on bare Classes --~--~-~--~~~---~--~~ 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, s

Re: Modified doto

2008-10-24 Thread CuppoJava
On non-backwards compatible language changes in general, isn't it trivial to write a source-code converter? Especially given the ease of Clojure's macro system, all you would need is a systematic find and replace on any code that uses the current doto right? That would save the manual labor of hav

Re: Modified doto

2008-10-24 Thread Christian Vest Hansen
On Thu, Oct 23, 2008 at 4:53 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote: >> Hi, >> >> On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto-> >> >> The name is actually also up to discussion. doto is already >> in use and this ch

Re: Modified doto

2008-10-24 Thread mac
On 23 Okt, 16:53, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote: > > > Hi, > > > On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto-> > > > The name is actually also up to discussion. doto is already > > in use and this change is incompa

Re: Modified doto

2008-10-23 Thread Stephen C. Gilardi
On Oct 23, 2008, at 10:53 AM, Rich Hickey wrote: > Any thoughts on this as part of the upcoming bit of breaking changes? I think it would be a very useful change. I'm in favor. --Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: Modified doto

2008-10-23 Thread Chouser
On Thu, Oct 23, 2008 at 10:53 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > I'd rather enhance doto to do this and not add another variant. The > break would be that current (doto x (foo 42)) would have to become > (doto x (.foo 42)). > > Any thoughts on this as part of the upcoming bit of breaki

Re: Modified doto

2008-10-23 Thread Rich Hickey
On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote: > Hi, > > On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto-> > > The name is actually also up to discussion. doto is already > in use and this change is incompatible to "legacy" code. > I couldn't come up with a good alternative.

Re: Modified doto

2008-10-21 Thread mb
Hello, On 21 Okt., 19:08, Chouser <[EMAIL PROTECTED]> wrote: > Here's my implementation: > > (defmacro >>_ [& exprs] > (list 'let (apply vector (mapcat (fn [expr] (list '_ expr)) exprs)) '_ )) Now this is a nice idea. > I used it a couple times after first writing it, but have since failed > t

Re: Modified doto

2008-10-21 Thread Martin DeMello
On Oct 21, 5:41 am, mb <[EMAIL PROTECTED]> wrote: > > It allows the full support of doto via the dot notation of > methods. And it supports on the other hand other functions > not only methods. One example is the new miglayout > interface in clojure-contrib. Thanks! That's going to be really usef

Re: Modified doto

2008-10-21 Thread Timothy Pratley
> Any thoughts? Awesome! :) --~--~-~--~~~---~--~~ 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 PROTE

Re: Modified doto

2008-10-21 Thread Sean Spencer
I also thought it was in the language and I just didn't know the name. Good to see it added! And "do-with" sounds like a good name to me. On Tue, Oct 21, 2008 at 12:33 PM, CuppoJava <[EMAIL PROTECTED]>wrote: > > +1 for do-with for me as well. > > Thank you for considering adding this to Clojure

Re: Modified doto

2008-10-21 Thread Chouser
On Tue, Oct 21, 2008 at 11:31 AM, mb <[EMAIL PROTECTED]> wrote: > > (xxx-> "Hello" (apply str <> [", " "World!"])) gives "Hello, World!". > > The <> is used to mark the "hole" where the value is to be inserted. I wrote something like this too. I called mine >>_ and used _ as the insert mark. He

Re: Modified doto

2008-10-21 Thread CuppoJava
+1 for do-with for me as well. Thank you for considering adding this to Clojure. I actually wrote this macro myself, but I've always thought it was in the API already and I just didn't know what it was called. --~--~-~--~~~---~--~~ You received this message because

Re: Modified doto

2008-10-21 Thread Rastislav Kassak
I vote for "do-with" too. I used to upgrade my Ruby runtime with Ola Bini's Kernel::with. It could be used exactly the same way as proposed do-with. However, do-with is more idiomatic name, IMHO. RK On 10/21/08, J. McConnell <[EMAIL PROTECTED]> wrote: > > > On 21 Okt., 17:24, Chouser <[EMAIL PR

Re: Modified doto

2008-10-21 Thread CuppoJava
If I understand the macro correctly, it takes an argument, and then inserts it as the second element into all of the following lists right? How about the name "with"? (with obj (. doSomething) (. doSomethingElse) (print stdOut)) I think i'm stealing it from Ruby, but i'm not sure. It's bee

Re: Modified doto

2008-10-21 Thread J. McConnell
> On 21 Okt., 17:24, Chouser <[EMAIL PROTECTED]> wrote: >> I don't see much wrong with "doto->", though "do-with" or "do->" might >> be okay. I'd probably vote against "do-unto-others-as" > I would vote for do-with. + 1 --~--~-~--~~~---~--~~ You received this mes

Re: Modified doto

2008-10-21 Thread mb
Hi, On 21 Okt., 17:24, Chouser <[EMAIL PROTECTED]> wrote: > I don't see much wrong with "doto->", though "do-with" or "do->" might > be okay.  I'd probably vote against "do-unto-others-as" I would vote for do-with. Sincerely Meikel --~--~-~--~~~---~--~~ You receiv

Re: Modified doto

2008-10-21 Thread mb
Hello Stephen, On 21 Okt., 17:05, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Is the ".." aspect of it the "automatically make a list if it's not   > one" part? This is actually a -> aspect. What I meant was: (.. x (getModel) (getRoot) (state)) is equivalent to (-> x .getModel .getRoot .sta

Re: Modified doto

2008-10-21 Thread Chouser
On Tue, Oct 21, 2008 at 11:13 AM, J. McConnell <[EMAIL PROTECTED]> wrote: > > I like "with", that's what JavaScript uses IIRC. I think JavaScript's "with" means something slightly different. I don't remember about Ruby. But as Stephen pointed out, this is only useful when the methods (or functi

Re: Modified doto

2008-10-21 Thread J. McConnell
I like "with", that's what JavaScript uses IIRC. - J. On Tue, Oct 21, 2008 at 11:10 AM, CuppoJava <[EMAIL PROTECTED]> wrote: > > If I understand the macro correctly, it takes an argument, and then > inserts it as the second element into all of the following lists > right? > How about the name "w

Re: Modified doto

2008-10-21 Thread Stephen C. Gilardi
On Oct 21, 2008, at 8:41 AM, mb wrote: > I'd like to propose the following chimera of doto and ->. > > (defmacro doto-> > [obj & forms] > (let [objx (gensym "obj__")] >`(let [~objx ~obj] > (do > ~@(map (fn [f] > (if (seq? f) >`(~(first f) ~

Re: Modified doto

2008-10-21 Thread mb
Hi, On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote: > (defmacro doto-> The name is actually also up to discussion. doto is already in use and this change is incompatible to "legacy" code. I couldn't come up with a good alternative... Sincerely Meikel --~--~-~--~~~---

Re: Modified doto

2008-10-21 Thread Chouser
On Tue, Oct 21, 2008 at 8:41 AM, mb <[EMAIL PROTECTED]> wrote: > > (doto-> (new JFrame "Hello, World!") > (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) > (miglayout SomeChild :AConstraint MoreChildren ...)) > > Any thoughts? Beautiful. I've found in practice that using doto seems okay at fi