[erlang-questions] Question about ETS documentation

Robert Raschke rtrlists@REDACTED
Mon Mar 31 05:14:31 CEST 2014


Hi Yves,

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.

Hope this helps,
Robby
 On Mar 30, 2014 11:45 PM, "Yves S. Garret" <yoursurrogategod@REDACTED>
wrote:

> Hello,
>
> I've been reading this documentation:
> http://www.erlang.org/doc/man/ets.html#lookup_element-3
>
> 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:
>
> ...
> Cx_PId = ets:lookup_element(IdsNPIds, Cx#cortex.id, 2),
> ...
>
> 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?
>
> Thanks in advance.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140331/b361f682/attachment.htm>


More information about the erlang-questions mailing list