<div dir="ltr"><div><div>No, they are facts. :-) The documentation of dict:append says:<br><br>"This function appends a new <span class="">Value</span> to the current list
of values associated with <span class="">Key</span>."<br><br></div>So it manages a list of values.<br><br></div>Robert<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 25 November 2013 09:02, Bengt Kleberg <span dir="ltr"><<a href="mailto:bengt.kleberg@ericsson.com" target="_blank">bengt.kleberg@ericsson.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">These are opinions, not facts.<br>
<br>
dict:append/3 creates a list of values. Try calling it several times and<br>
you will see.<br>
If you only want one value use dict:store/3.<br>
<br>
<br>
bengt<br>
<div><div class="h5"><br>
On Mon, 2013-11-25 at 15:38 +0800, 王靖易 wrote:<br>
> Hi,<br>
> I'm a beginner of erlang and have found some problems in my project.<br>
> After doing some google I found here and wish someone could help me.<br>
> I'm using the erlang structure 'dict' for a key-value table in my<br>
> program, but I found that the return value of dict:fetch and dict:find<br>
> is actually [Value] or {ok, [Value]} (means I get a list containing<br>
> the value instead of the original one). However, this is not the<br>
> problem, the real problem is, this happens only in some situations<br>
> which I can't find what it is.<br>
> An example:<br>
> Eshell V5.8.5 (abort with ^G)<br>
> 1> A = dict:new().<br>
> {dict,0,16,16,8,80,48,<br>
> {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},<br>
> {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}<br>
> 2> A2 = dict:append(key, value, A).<br>
> {dict,1,16,16,8,80,48,<br>
> {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},<br>
> {{[],[],[],[],[],[],[],[],[],<br>
> [[key,value]],<br>
> [],[],[],[],[],[]}}}<br>
> 3> dict:find(key, A2).<br>
> {ok,[value]}<br>
><br>
><br>
> My erlang environment is R14B04 on ubuntu 12.04. Could any one tell<br>
> me why the return value of dict:find is not the same as the doc?<br>
><br>
><br>
> Best regards,<br>
> Jingyi Wang<br>
</div></div>> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div>