[erlang-questions] Clueless am I
Mon Apr 25 22:11:56 CEST 2016
> -----Ursprüngliche Nachricht-----
> Von: Donald Steven [mailto:t6sn7gt@REDACTED]
> Gesendet: Montag, 25. April 2016 21:40
> An: Stefan Schmiedl <s@REDACTED>; Hugo Mills <hugo@REDACTED>; erlang-
> Betreff: Re: AW: [erlang-questions] Clueless am I
> Stefan and Hugo,
> Is there any data structure in Erlang that will accept modification?
don't know, never needed one :-)
> This is quite beyond me as to how to add elements to a data structure.
> I've hit the same dead end with lists. If one has, for example, a
> and one wants to add a customer, do you really need to have a new (second)
yes ... and no.
yes: you get a reference to the new database
no: much of the "old" data structure can be reused
Lists are actually a good example for this type of thinking. They are made
"cells", which hold the value and a reference to the rest of the list.
You keep track of a list by a firm grasp on its first cell.
Adding a value to a given list comes down to wrapping the value into a new
cell, which references the "old first cell" as its rest.
So you're getting a new list on each "change", but all of the "old" data
BTW: Suffering a few headaches while getting used to these concepts is not
More information about the erlang-questions