Fri May 7 14:59:43 CEST 2004
"Ulf Wiger (AL/EAB)" <> writes:
> The 'lines' contrib on jungerl can actually be used for this.
> It's basically a tuple tree with array semantics.
> As far as I know, the lines module has a user base of 1:
> Joe Armstrong decided to use it for some "emacs clone"
> (or rather perhaps a pico_emacs, right?)
I have something similar in the Jungerl too, cord.erl in the Ermacs
editor. IIRC it's basically the same design as lines.erl except that
it operates on contiguous/linear text rather than lines. Internally it
breaks it into a tree with size-bounded binaries on the leaves.
An excellent paper about how to easily write balanced trees in a
functional language is:
"Implementing sets efficiently in a functional language"
If you wanted a more tuple-like data structure then I think you could
use the gb_trees module (in OTP) with the element-number for your
key. The 'dict' module (a hashtable) may work well too.
BTW, the other day I was going to convert some ETS code over to use
gb_trees, but it was missing a 'next' function that I needed. I think
gb_trees:iterator(Tree, KeyToStartFrom) would be a nice feature (for
implementing SNMP 'get_next').
More information about the erlang-questions