[erlang-questions] questions about dict
Tue Aug 21 08:09:48 CEST 2007
Dustin Sallings <> writes:
> There are a couple of things about dict I'm working around in some
> of my programs and was wondering if there's a better way or something.
> 1) There doesn't seem to be a way to get the length of a dict
> directly, although it seems to be directly stored (I'm using fold
> right now to calculate it).
It seems to be undocumented for no good reason. We will update the
documentation in R12B.
> 2) I can't seem to make a guard for a dict because the record
> format is unavailable to me at compile time (I'm working around this
> by matching tuple and hard-coding a tuple pattern for identifying a
That is intentional (and even mentioned in the documentation).
There is no portable way to test for a dict in a guard.
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions