<table cellspacing='0' cellpadding='0' border='0' ><tr><td valign='top' style='font: inherit;'>im using:<br>http://www.erlang.org/doc/reference_manual/part_frame.html<br>but cant really figure it out. i didnt expect this to work but compiled anyway:<br>2> c("c:/Program Files/erl5.6.2/usr/serec", [{outdir, "c:/Program Files/erl5.6.2/usr/"}]).<br>c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer/1 undefined<br>c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer2/1 undefined<br>c:/Program Files/erl5.6.2/usr/serec.erl:23: premature end<br>error<br>3> <br><br><br>obv this is just a toy program but say I have a function that squares the integers of a list from 1 to the send parameter.<br>so i want to send a message to that function.<br><br><br>-module(serec).<br>-export([seq/2,squarer/1,squarer2/1]).<br> <br>seq(Start, End) -> seq(Start, End, []).<br><br>seq(Start, End, Acc) when Start
=< End -><br> seq(Start, End-1, [End|Acc]);<br>seq(_, _, Acc) -><br> Acc.<br><br>squarer(X) -><br> receive<br> Pattern [when Pattern > 7] -><br> [X*X || X <- [seq(1, 7]];<br> end<br><br>squarer2(X) -><br> receive<br> when X > 7 -> [X*X || X <- [seq(1, 7]];<br> end<br><br>squarer(X) ! 2+6<br><br></td></tr></table><br>
<hr size=1>
Låna pengar utan säkerhet.<br>
<a href=http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014>Sök och jämför lån hos Kelkoo.</a>