The dict structure in Erlang doesn't allow you to give it a name. And it's probably pointless to have a name in a dict. A dict is a mere key/value dictionary, whose representation is not defined.
If you have multiple dictionaries that you want to refer to, it's probably a good idea to store them in a record or in a tuple, to "name" them. You shouldn't create variable names out of function parameters.
{my_dict, Dict}
#state{
my_dict = Dict
}
Supposing you need to have the dictionary names as d_mycustomname, you could write something like:
atomize(Name) ->
list_to_atom("d_" ++ Name).
As the other respondents, I'm not sure this is exactly what you've asked for. Please re-formulate your question to get better answers. My answer at this point is just guess-work driven by alcohol.
AFTER YOUR UPDATE:
Regarding the way you add values to the dictionary, what you want is probably an update and not a store operation.
enqueue(D, {_Id, Key, Value}) ->
Update = fun (Old) -> Old ++ [Value] end,
dict:update(Key, Update, [Value], D).
That will append your value to the "queue". If not present yet, it will create one.
Regarding the prefixed names, you may store your dictionaries in a proplist:
enqueue(ListOfDicts, {Id, Key, Value}) ->
Name = "dict_" ++ Id,
case proplists:get_value(Name, ListOfDicts) of
undefined -> % No such a dict yet
[{Name, dict:new()}|ListOfDicts];
D ->
Update = fun (Old) -> Old ++ [Value] end,
NewD = dict:update(Key, Update, [Value], D),
lists:keyreplace(Name, 1, ListOfDicts, {Name, NewD})
end.
I didn't test the code, this is just t give you an idea about what I'm suggesting.
Dthe dictionary? Do you want the key of the dictionary to be the integer? What do you mean by "attach it do D"?