<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html>
<head>
<meta name=Generator content="Microsoft Word 11 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:Arial;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
span.Typed
{font-family:"Courier New";}
span.tty
{font-family:"Courier New";}
span.Name
{font-style:italic;}
span.Variable
{font-family:"Times New Roman";
font-style:italic;}
span.EmailStyle21
{font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><span style='color:navy'>You don’t send messages to
functions, you send them to processes. Also, you’re missing periods after the squarer
and squarer2 functions (after the ends), which accounts for two of the compiler
errors.</span></p>
<p class=MsoNormal><span style='color:navy'> </span></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>
<div>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=2 width="100%" align=center tabindex=-1>
</div>
<p class=MsoNormal><b><span style='font-family:Tahoma'>From:</span></b><span
style='font-family:Tahoma'> erlang-questions-bounces@erlang.org
[mailto:erlang-questions-bounces@erlang.org] <b>On Behalf Of </b>not norwegian
swede<br>
<b>Sent:</b> Thursday, July 03, 2008 04:04<br>
<b>To:</b> erlang-questions@erlang.org<br>
<b>Subject:</b> [erlang-questions] help with message-passing syntax</span></p>
</div>
<p class=MsoNormal> </p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top style='padding:0in 0in 0in 0in'>
<p class=MsoNormal style='margin-bottom:12.0pt'>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</p>
</td>
</tr>
</table>
<p class=MsoNormal> </p>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=1 width="100%" align=center>
</div>
<p class=MsoNormal>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></p>
</div>
</div>
</body>
</html>