I am new to the world of Erlang so I am trying to experiment with it.
I have an ETS table that is called numbers.
ets:new(numbers,[ordered_set,named_table])
It has the format [{Name,Number},{Name,Number}] etc.
I am wondering is there a way to output the contents of the whole the ets table?
Tl;dr
you can use
Where
Tabis your table name, i.e.numbers.In depth:
The second argument is a match pattern, leaving "free variables"
'$0'and'$1'.Let's say you inserted:
You could get out all
{_, 45}tuples with:By making all (in this case, 2) of the tuple parameters free variables, you will match everything in the table.
I highly recommend reading Learn You Some Erlang for more info!