2008/6/3 Richard Carlsson <<a href="mailto:richardc@it.uu.se">richardc@it.uu.se</a>>:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Rapsey wrote:<br>
> Actually there is an array:<br>
> <a href="http://erlang.org/doc/man/array.html" target="_blank">http://erlang.org/doc/man/array.html</a><br>
><br>
> It was added in R12B I think.<br>
<br>
</div>Yes, but it is a purely functional data structure,<br>
and still has O(log n) access time, although with a<br>
much better constant factor than dict or gb_trees.</blockquote><div><br>The only O(1) data structure I know of in Erlang are ETS and dict, though as Richard says the constant factor is higher. Which method you choose is of course entirely dependent on your problem. Fortunately the interfaces to dict, array are gb_trees sufficiently alike so that you can hide them in macros to facilitate testing and comparing. You can do it with ets but it takes a little more fiddling.<br>
<br>Robert<br><br></div></div>