> 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)
--Steve
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":
Why can't I use ensure inside of a dosync block? Is there another way to perform a transaction?
(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)