Re: Help with the dot operator special form

2009-03-22 Thread Stuart Sierra
On Mar 21, 10:23 pm, Timothy Pratley timothyprat...@gmail.com wrote: You may be able to achieve what you want by directly accessing Clojure's reflector class instead of using the special form: You could also call Java's reflection API directly. -Stuart Sierra

Re: Help with the dot operator special form

2009-03-22 Thread David Nolen
Thanks all for the pointers, this looks like a workable approach. In my case I'm not bothered by the performance hit from reflection (CPS transformation creates an obscene number of anonymous functions anyway). However I am running into an issue. Here's my dot function: (def not-seq? (comp not

Re: Help with the dot operator special form

2009-03-22 Thread Eric Tschetter
(let [myref (ref {})]   (dot    clojure.lang.LockingTransaction    (list 'runInTransaction (fn [] (commute myref assoc :mykey :myval) I'm getting a instance method not found exception which seems odd. I looked at LockingTransaction.java and I see that runInTransaction does in fact take

Re: Help with the dot operator special form

2009-03-22 Thread David Nolen
That was it! At one point I knew these things. Thanks much. On Sun, Mar 22, 2009 at 2:18 PM, Eric Tschetter eched...@gmail.com wrote: (let [myref (ref {})] (dot clojure.lang.LockingTransaction (list 'runInTransaction (fn [] (commute myref assoc :mykey :myval) I'm getting a

Re: Help with the dot operator special form

2009-03-22 Thread David Nolen
Thanks again to all for the help, clj-cont now supports the new and dot special forms. This also means that dosync, doto, .. all work perfectly fine from within a with-call-cc form. You can now write things like this: (let [cc (atom nil)] [(with-call-cc (. (let-cc k (reset! cc k)

Help with the dot operator special form

2009-03-21 Thread David Nolen
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

Re: Help with the dot operator special form

2009-03-21 Thread Kevin Downey
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

Re: Help with the dot operator special form

2009-03-21 Thread David Nolen
On Sat, Mar 21, 2009 at 9:10 PM, Kevin Downey redc...@gmail.com wrote: 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

Re: Help with the dot operator special form

2009-03-21 Thread David Nolen
Or rather I did not express that requirement clearly enough. On Sat, Mar 21, 2009 at 9:21 PM, David Nolen dnolen.li...@gmail.com wrote: On Sat, Mar 21, 2009 at 9:10 PM, Kevin Downey redc...@gmail.com wrote: you want defmacro not definline. the result of a macro is a data structure. that

Re: Help with the dot operator special form

2009-03-21 Thread Timothy Pratley
You may be able to achieve what you want by directly accessing Clojure's reflector class instead of using the special form: user= (clojure.lang.Reflector/invokeInstanceMethod Hello substring (to-array [1 2])) e There is also invokeStaticMethod (and others). Regards, Tim. On Mar 22, 12:04