Sorry, I thought this post is about mnesia dirty_update_counters<div>My bad<br><br>среда, 7 августа 2013 г., 17:03:23 UTC+4 пользователь Ulf Wiger написал:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style="word-wrap:break-word"><br><div><div>On 7 Aug 2013, at 14:58, Evgeny M <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="i2tjSf7XkQIJ">donped...@gmail.com</a>> wrote:</div><br><blockquote type="cite"><span style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">I miss an ability to increment more than one counter for a given key.</span></blockquote><br></div><div>Actually, you *can* do that already.</div><div><br></div><div><div>Eshell V5.10.2 (abort with ^G)</div><div>1> T = ets:new(t, [set]).</div><div>16400</div><div>2> ets:insert(T, {c, 0, 0, 0}).</div><div>true</div><div>3> ets:update_counter(T, c, [{2,1},{3,10},{4,100}]).</div><div>[1,10,100]</div><div>4> ets:lookup(T, c).</div><div>[{c,1,10,100}]</div><div><br></div><div>What I wanted to add was to capture values in previous operations</div><div>and use them for derived operations later in the same atomic update.</div><div><br></div><div>BR,</div><div>Ulf W</div></div><br><div>
<span style="border-collapse:separate;border-spacing:0px"><div><div>Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.</div><div><a href="http://feuerlabs.com" target="_blank">http://feuerlabs.com</a></div></div><div><br></div></span><br>
</div>
<br></div></blockquote></div>