Storing a dictionary in a dictionary in Erlang -
i have dictionary use store dictionary using name of parameter.
i right hand side mismatch error.
here code
handle_cast({setstate, id}, state) -> id0 = dict:new(), dqueue = queue:new(), uqueue = queue:new(), id1 = dict:store(dqueue, [dqueue], id0), id2 = dict:store(uqueue, [uqueue], id1), id3 = dict:store(dspeed, [], id2), id4 = dict:store(uspeed, [], id3), d = dict:store(id, [id4], state), state = d, {noreply, state}; im not sure error comes from. thought might because store id key in main dictionary new internal dictionary value.
i need name of internal dictionary value of id there many of them , need access them id later.
am setting dictionary correctly? erlang allow dictionaries hold dictionaries?
thanks
without trying code, bet badmatch when doing state = d given state bound in function's head. on top of this, uspeed , dspeed should undefined unless copy/pasted function wrong.
Comments
Post a Comment