you want defmacro not definline. the result of a macro is a data structure. that data structure is then evaluated in place of the call to the macro. definline (I think?) behaves similar to a function, so if it returns a data structure, you just get that data structure (the data structure is not then evaluated)
On Sat, Mar 21, 2009 at 6:04 PM, David Nolen <dnolen.li...@gmail.com> wrote: > I'm wondering if it's possible to create a Clojure function that does what > the dot operator does. It seems like this would be possible with definline > but I'm unable to get this to work or figure it out. For example I want to > be able write something like the following: > (dot "Hello world" (list 'substring 1 2)) > Trying to use definline like this: > (definline dot > [obj member-exp] > `(. ~obj (~...@member-expr))) > Simply throws an error. > I don't need variable arity, I will always pass an instance or class > following by a list representing the member expression. > Is this impossible? > It seems like this would be generally useful to allow variable method > calling on Java objects. As to why I want it to implement this, it would be > far simpler to support Java interop from clj-cont if the dot operator could > be expressed as a Clojure function. > Thanks! > David > > > -- 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 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 -~----------~----~----~----~------~----~------~--~---