I see, using "->" with "." will not create a chain of "new" invocations, the best solution that iv found is: user=> (String. (String.)) "" user=> (macroexpand (String. (String.))) "" user=> (macroexpand `(String. (String.))) (new java.lang.String (java.lang.String.))
Nesting is a must :) Thank you both for your helpful reply On Jun 8, 10:51 pm, Kevin Downey <redc...@gmail.com> wrote: > you need to pass something in. > example: > > => (-> "foo" String. String.) > "foo" > > => (macroexpand '(-> String. String.)) > (new String String.) > > => (macroexpand '(-> "foo" String. String.)) > (new String (clojure.core/-> "foo" String.)) > => (macroexpand '(-> "foo" String.)) > (new String "foo") > > String. is only treated as new String ... when it is placed in the > function position (String. ...) > in (-> String. String.) the first String. is never put in the > function position, so effectively you get > (String. String.) > > > > On Mon, Jun 8, 2009 at 12:38 PM, ronen<nark...@gmail.com> wrote: > > > Following a blog post on building large object graphs I was suggested > > with the following solution: > > (def nested-object (-> GrandFather. Father. GrandSon.)) > > > this indeed seems to be correct however fails in even in a simple > > example: > > > user=> (-> String. String.) > > java.lang.ClassNotFoundException: String. (NO_SOURCE_FILE:7) > > > expanding the macros involved seems to reveal the issue: > > > user=> (macroexpand-1 `(-> String. String.)) > > (java.lang.String. java.lang.String.) > > > the "." macro isn't expanded. > > > Is there a way of applying nested macros? > > (iv searched for "applying nested macros" with no results). > > -- > And what is good, Phaedrus, > And what is not good— > Need we ask anyone to tell us these things? --~--~---------~--~----~------------~-------~--~----~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---