^:once on fn* (not fn, the fn macro doesn't propagate metadata) instructs
the commielr to clear closed-overs ASAP. It follows that you can't call
such a function twice because it forgets its closed-overs.


On Wed, Sep 11, 2013 at 4:36 PM, Brian Craft <craft.br...@gmail.com> wrote:

> ugh. Can't find documentation for this. What does it do?
>
> On Wednesday, September 11, 2013 2:22:56 AM UTC-7, Christophe Grand wrote:
>
>>
>> On Wed, Sep 11, 2013 at 6:00 AM, Brian Craft <craft...@gmail.com> wrote:
>>
>>> (defmacro transaction
>>>   [& body]
>>>   `(transaction* (fn [] ~@body)))
>>>
>>> I'm not sure how to avoid that. The anonymous function created here
>>> doesn't take parameters.
>>>
>>
>> The fix for this is:
>> (defmacro transaction
>>   [& body]
>>   `(transaction* (^:once fn* [] ~@body)))
>>
>> It should be the default for all one-shot fns.
>>
>> Christophe
>>
>> --
>> On Clojure http://clj-me.cgrand.net/
>> Clojure Programming http://clojurebook.com
>> Training, Consulting & Contracting http://lambdanext.eu/
>>
>


-- 
On Clojure http://clj-me.cgrand.net/
Clojure Programming http://clojurebook.com
Training, Consulting & Contracting http://lambdanext.eu/

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to