(defmacro transaction
  [& body]
  `(transaction* (fn [] ~@body)))

I'm not sure how to avoid that. The anonymous function created here doesn't 
take parameters.

On Tuesday, September 10, 2013 8:55:42 PM UTC-7, Brian Craft wrote:
>
> Ah. So the root of my problem is that the jdbc/transaction macro creates a 
> closure in my function..
> (defmacro transaction
>
>
> On Tuesday, September 10, 2013 7:34:32 PM UTC-7, Armando Blancas wrote:
>>
>> Can anyone explain to me what's happening here? Something about creating 
>>> a anonymous function?
>>>
>>
>> The problem is not creating the anonymous function but that it closes 
>> over the matrix argument. The closure passed on to blah will keep a 
>> reference to matrix until blah returns. This won't happen if the anonymous 
>> function takes the matrix as a parameter:
>>
>> (defn blah [func v] (func v))
>> (defn load-exp [matrix]
>>   (blah
>>     (fn [m] (dorun (map identity m))) matrix))
>>  
>>
>

-- 
-- 
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