> > > Why can't I use ensure inside of a dosync block? Is there another way to >> perform a transaction? >> > > You can, but "map" is lazy. It's not being evaluated within the dosync. One > way to fix the code is to force map to evaluate within the dosync using > "dorun": > > (dosync (dorun (map ensure [account1 account2]))) > > See (doc dorun) for some more info. > > For a simple demo (for others), you might want to stick with: > > (ensure account1) > (ensure account2) >
Thanks for the explanation. This is my modified demo - no more laziness: (dosync [(ensure account1) (ensure account2)]) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---