[erlang-questions] How to Update List Elements A Lot
Tue Jul 21 14:46:34 CEST 2015
Good points! Thank you Vance.
On Tue, Jul 21, 2015 at 7:15 PM, Vance Shipley <vances@REDACTED> wrote:
> On Tue, Jul 21, 2015 at 9:30 AM, Hugo Wang <w@REDACTED> wrote:
> > In other language, like C or Python, we can init an output list and then
> > update its elements inline. In Erlang, what I currently do, would make a
> > copy of the list every time when an element need to update. This looks
> > quite right.
> If the problem is that it doesn't feel right than there isn't a
> problem yet. Welcome to functional programming.
> The Erlang way is 1) make it work, 2) make it correct, 3) optimize.
> Most of the time you go straight to production around 2) and never get
> to 3).
> If you are going to worry about code performance the only answer is
> measure, measure, measure. See if it does matter before working on an
> imagined problem.
> Immutability helps greatly with 2) and that really is the most
> important thing (presuming you got past 1).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions