[erlang-questions] questions about dict
Tue Aug 21 09:12:28 CEST 2007
On Aug 20, 2007, at 23:09, Bjorn Gustavsson wrote:
>> 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).
> Use orddict:size/1.
> It seems to be undocumented for no good reason. We will update the
> documentation in R12B.
Ah, I see this exists in dict as well. Thanks. It seemed to be an
obvious missing thing.
>> 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.
Where is this documented? I looked around for a while and couldn't
find anything either way. There's clearly a gap in my understanding
of guards, records, or dicts.
More information about the erlang-questions