Erlang Mailing Lists

Author Message

<  Erlang  ~  noob + ETS

keymone
Posted: Mon Sep 17, 2007 8:01 am Reply with quote
User Joined: 17 Sep 2007 Posts: 11 Location: Lviv, Ukraine
hello everybody Smile

i can't get it:

T = ets:new( data, [set] ),
ets:insert( T, {a,1} ).

is working ok but

ets:new( data, [set] ),
ets:insert( data, {a,1} ).

gives me badarg.

why is that? is not "data" atom used for identifying the table?

thanks!
View user's profile Send private message MSN Messenger ICQ Number
michal
Posted: Mon Sep 17, 2007 1:38 pm Reply with quote
User Joined: 20 Jul 2006 Posts: 44 Location: London
Hi,
You will need to pass on named_table option so that the name will be associated with the table identifier. Read here http://www.erlang.org/doc/man/ets.html#new/2 and try this:

ets:new( data, [set, named_table]).


Michal

_________________
http://www.erlang-consulting.com
View user's profile Send private message
keymone
Posted: Mon Sep 17, 2007 8:07 pm Reply with quote
User Joined: 17 Sep 2007 Posts: 11 Location: Lviv, Ukraine
thanks!!!

there is that "tid() | atom()" all over the documentation about ETS - i thought tables are named by default Smile
View user's profile Send private message MSN Messenger ICQ Number

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum