<p>Hi Yves,</p>
<p>ets stores tuples (aka 'objects' in the documentation), where by default the first element is taken to be the key. The lookup/2 function will return all objects (ie., tuples) that match the key. Whereas lookup_element/3 will only return the term stored at the requested position on the matching tuples.</p>
<p>Hope this helps,<br>
Robby<br>
</p>
<div class="gmail_quote">On Mar 30, 2014 11:45 PM, "Yves S. Garret" <<a href="mailto:yoursurrogategod@gmail.com">yoursurrogategod@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div>Hello,<br><br></div>I've been reading this documentation:<br><a href="http://www.erlang.org/doc/man/ets.html#lookup_element-3" target="_blank">http://www.erlang.org/doc/man/ets.html#lookup_element-3</a><br>
<br></div>What I have a hard time figuring out is what the Pos means. Why would it be needed at all? I'm looking at this code:<br><br>...<br>Cx_PId = ets:lookup_element(IdsNPIds, Cx#<a href="http://cortex.id" target="_blank">cortex.id</a>, 2),<br>
...<br><br></div>And I have no idea what this and why have it there. I've already specified the element that we're searching for, why the position? Does the position refer to the element that's located inside of the return value? As in, I want the 2nd element from the return value?<br>
<br></div>Thanks in advance.<br></div></div>
<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>
<br></blockquote></div>