[erlang-questions] how to add a tuple to a list.
Richard A. O'Keefe
Fri Jan 30 04:07:34 CET 2015
On 30/01/2015, at 8:53 am, Roelof Wobben <r.wobben@REDACTED> wrote:
> I did some trail and error and saw this :
> 14> Db1 = db:new().
> 15> Db2 = db:destroy(Db1).
> ** exception error: no match of right hand side value ok
> 16> db:destroy(Db1).
> So it seems you do not have to use a variable when destroying.
THERE IS NO DESTROYING.
say “make the memory of this data structure available for reuse
RIGHT NOW”. If you don’t want to use a data structure any more,
just stop mentioning it, and eventually the run time system
will clean up.
Why are you even saying
Db2 = db:destroy(Db1)
instead of just
If I saw Db2 = db:destroy(Db1) in a program where I knew that
a Db was a list of pairs, I would expect db:destroy/1 to
return , an empty Db.
More information about the erlang-questions