<div dir="ltr">Good points! Thank you Vance.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 21, 2015 at 7:15 PM, Vance Shipley <span dir="ltr"><<a href="mailto:vances@motivity.ca" target="_blank">vances@motivity.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Jul 21, 2015 at 9:30 AM, Hugo Wang <<a href="mailto:w@mitnk.com">w@mitnk.com</a>> wrote:<br>
> In other language, like C or Python, we can init an output list and then<br>
> update its elements inline. In Erlang, what I currently do, would make a<br>
> copy of the list every time when an element need to update. This looks not<br>
> quite right.<br>
<br>
</span>If the problem is that it doesn't feel right than there isn't a<br>
problem yet.  Welcome to functional programming.<br>
<br>
The Erlang way is 1) make it work, 2) make it correct, 3) optimize.<br>
Most of the time you go straight to production around 2) and never get<br>
to 3).<br>
<br>
If you are going to worry about code performance the only answer is<br>
measure, measure, measure.  See if it does matter before working on an<br>
imagined problem.<br>
<br>
Immutability helps greatly with 2) and that really is the most<br>
important thing (presuming you got past 1).<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
     -Vance<br>
</font></span></blockquote></div><br></div>