[erlang-questions] how to scale into the cloud using process? example computing simple average
Tue May 19 09:55:04 CEST 2009
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.
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?
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:
N=0,lists:foreach(fun(X)-> spawn(fun()-> N+X end)end,List),N/length(List).
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 :(
I have also read that processes must be in recursive? How would I write
this process in recursive?
and as soon as my program is made of processes where is good documentation
for making it scale into the cloud?
- Kid Erlang
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions