[erlang-questions] Return [Value] of erlang dict:find fetch
王靖易
wangjingyi0425@REDACTED
Mon Nov 25 08:38:21 CET 2013
Hi,
I'm a beginner of erlang and have found some problems in my project. After
doing some google I found here and wish someone could help me.
I'm using the erlang structure 'dict' for a key-value table in my
program, but I found that the return value of dict:fetch and dict:find is
actually [Value] or {ok, [Value]} (means I get a list containing the value
instead of the original one). However, this is not the problem, the real
problem is, this happens only in some situations which I can't find what it
is.
An example:
Eshell V5.8.5 (abort with ^G)
1> A = dict:new().
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}
2> A2 = dict:append(key, value, A).
{dict,1,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{{[],[],[],[],[],[],[],[],[],
[[key,value]],
[],[],[],[],[],[]}}}
3> dict:find(key, A2).
{ok,[value]}
My erlang environment is R14B04 on ubuntu 12.04. Could any one tell me
why the return value of dict:find is not the same as the doc?
Best regards,
Jingyi Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131125/0556eb04/attachment.htm>
More information about the erlang-questions
mailing list