Alternatives to records

Richard Carlsson richardc@REDACTED
Wed Dec 6 16:38:56 CET 2000


On Wed, 6 Dec 2000, Peter Andersson wrote:

> I'm looking for a data representation to use as an alternative to
> Erlang records in a particular application of mine. I want the
> possibility to reference data elements by means of labels rather than
> positions.
> [...]

For small sets of keys (up to a dozen or so), using a list is faster than
other data structures because of its very small traversation overhead.
Using ordered lists of tuples {Tag, ...} and a lookup function utilizing
the fact that the key is the first element and that the lists are ordered
should be a good way of doing it.

	/Richard Carlsson


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://www.csd.uu.se/~richardc/






More information about the erlang-questions mailing list