Thanks Randall.

My background is mostly in imperative languages, including perl
and perl has closure, so it looks commute uses closure concept
to implement this. Is it right?

Thanks again,
sun


On Dec 16, 9:28 pm, Randall R Schulz <rsch...@sonic.net> wrote:
> On Tuesday 16 December 2008 18:10, wubbie wrote:
>
> > Hello,
>
> > My question is that conj takes two argument and how conj finds
> > the first argument? Is it somehow provided by commute?
>
> Consider the documentation for (commute ...) (at
> <http://clojure.org/api>):
>
> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
> commute ref fun & args)
> Must be called in a transaction. Sets the in-transaction-value of ref
> to:
>
> (apply fun in-transaction-value-of-ref args)
>
> and returns the in-transaction-value of ref.
>
> At the commit point of the transaction, sets the value of ref to be:
>
> (apply fun most-recently-committed-value-of-ref args)
>
> Thus fun should be commutative, or, failing that, you must accept
> last-one-in-wins behavior. commute allows for more concurrency than
> ref-set.
> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
>
> In both cases, the first argument to the "fun" argument to (commute ...)
> is implicitly either the "in-transacxtion-value-of-ref"
> or "most-recently-committed-value-of-ref". All other / subsequent
> arguments are those appearing as the 3rd and subsequent arguments to
> (commute ...).
>
> > Thanks,
> > sun
>
> Randall Schulz
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to