hi everybody.  I have just discovered Erlang!  it is very exciting.  I have been making scripts with perl that call each other so I have hundreds of scripts running at once.  my friend told me Erlang has processes so I thought I could replace my scripts with Erlang!  I had bought the book programming Erlang.  very good book and fun to read, but I still have questions about Erlang!  it is my first functinal language and so far that has been pretty confusing!  I am still reading the book too.<br>
<br>recursive blew my mind!  I have tried forever on this code and I finally have it working.  there are no for loops in erlang so I had to write my own into recursive.  here is the program what I came up with:<br><br>-module(adder).<br>
-compile(export_all).<br><br>add_up_list(List)->LengthOfList=erlang:length(List)-1,for_loop(0,LengthOfList,List).<br>for_loop(CurrentLocationInList,LengthOfList,List)->if CurrentLocationInList==LengthOfList true->0;false->lists:nth(CurrentLocationInList+1,List)+for_loop(CurrentLocationInList+1,LengthOfList,List).<br>
<br>the goal of this program is to take all the numbers of the list and add them together.  but it will not compile!  here is the error:<br><br>~$ erlc adder.erl<br>./adder.erl:5: syntax error before: true<br>./adder.erl:4: function for_loop/3 undefined<br>
<br>where is my program wrong?  I have written programs before this and they compiled.  but this one really stumps me.  I cannot figure out what is wrong.<br><br>I have not got to the paralell part of Erlang yet but I hear it lets you automagically scale into the cloud!  that is my goal with Erlang!<br>
<br>- Kid Erlang<br>