hi again everybody! it has been a few months of using Erlang! I have
been porting my Perl scripts into Erlang and now I am almost done!!!
thanks for your help before getting my scripts ported over.<br>
<br>
my program is now in Erlang except I do not see how to make it scale
into the cloud. I have heard I need to use Erlang process to do this
but I do not understand how this is works. I have tried using spawn
command to create a processes but it does not seem to do anything.
Where is good documentation for how to use spawn?<br>
<br>
I try to write simple example with spawn. I want to make simple
average of these numbers as example, but calculate in paralell so it
can automagically scale into the cloud! Here is my program:<br>
<br>
-module(averager).<br>
-compile(export_all).<br>
<br>
paralell_average(List)-><br>
N=0,lists:foreach(fun(X)-> spawn(fun()-> N+X end)end,List),N/length(List).<br>
<br>
but it always returns 0.0 no mater what List is! what am I doing
wrong? :( I have tried to use N+=X like in Perl but I think this does
not work because of the single assignment? same with N=N+X. how can I
make processes make the value of N go up? I don't get it :(<br>
<br>
I have also read that processes must be in recursive? How would I write this process in recursive?<br>
<br>
and as soon as my program is made of processes where is good documentation for making it scale into the cloud?<br>
<br>
- Kid Erlang