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)
(k "Hello"))
substring
2))
(@cc "Goodbye")])
-> ["llo" "odbye"]
One caveat is that you can't use the let-cc form within a dosync block
that's embedded in a with-call-cc. This is probably for the best anyway.
Also since the dot and new forms are being transformed into a version that
relies on reflection you can't expect this code to be super performant.
That may or may matter depending on your use case ;)
On Sun, Mar 22, 2009 at 5:28 PM, David Nolen <[email protected]> wrote:
> That was it! At one point I knew these things. Thanks much.
>
>
> On Sun, Mar 22, 2009 at 2:18 PM, Eric Tschetter <[email protected]>wrote:
>
>>
>> > (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
>> > Callable, and fn's are Callable. Any thoughts?
>>
>> I haven't double checked the clojure code, but it looks like you are
>> trying to call a static method, not an instance method, and that is
>> what is causing the exception.
>>
>> --Eric Tschetter
>>
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---