Groups
Sign in
Groups
elixir-lang-talk
Conversations
About
Send feedback
Help
why :ets.first and :ets.last return the same value?
37 views
Skip to first unread message
zak9...@gmail.com
unread,
Feb 25, 2015, 11:36:05 PM
2/25/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to elixir-l...@googlegroups.com
iex(1)> :ets.new(Test, [:named_table])
iex(2)> :ets.insert(Test, [{:foo, 1, 2}, {:bar, 1, 2}])
In the above example both :ets.first(Test) and :ets.last(Test) return :bar. why?
Saša Jurić
unread,
Feb 26, 2015, 1:58:45 AM
2/26/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to elixir-l...@googlegroups.com
It's explained in ETS docs:
http://www.erlang.org/doc/man/ets.html#last-1
Returns the last key Key according to Erlang term order
in the table Tab of the ordered_set type
.
If the table is of any other type, the function is synonymous to first/2
.
Reply all
Reply to author
Forward
0 new messages