<div>
<div><span>Thanks all, that fixed it.</span></div><div><span><br></span></div><div><span>Sid<br>
</span>
<span></span>
<p style="color: #a0a0a0;">On Wednesday, 22 June 2011 at 9:10 PM, Steve Strong wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div>Your spawn command is passing the arguments incorrectly - you need:<div><br></div><div> spawn(?MODULE, format_temps, [[{moscow,{f,-40}}, {bangalore,{f,40}}, {wellington, {c,24}}]])</div><div><br></div><div>without the outer list, you were trying to call first:format_temps({moscow,{f,-40}}, {bangalore,{f,40}}, {wellington, {c,24}}), which doesn't exist.</div><div><br></div><div>Cheers,</div><div><br></div><div>Steve<br><div>
<div><div>--</div><div>Steve Strong, Director, id3as</div><div><a href="http://twitter.com/srstrong">twitter.com/srstrong</a></div></div><div><br></div><br>
</div>
<br><div><div>On 22 Jun 2011, at 11:03, Sid Carter wrote:</div><br><blockquote type="cite"><div><span style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>-module(first).</div><div>% call would look like format_temps([{moscow,{f,-40}}, {bangalore,{f,40}}, {wellington, {c,24}}]).</div><div>-export([format_temps/1, start/0]).</div><div>format_temps([]) -></div><div><span style="white-space: pre; "> </span>ok;</div><div>format_temps([City|Rest]) -></div><div><span style="white-space: pre; "> </span>print_temp(convert_to_celsius(City)),</div><div><span style="white-space: pre; "> </span>format_temps(Rest). </div><div>convert_to_celsius({City, {c, C}}) -></div><div><span style="white-space: pre; "> </span>{City, {c, C}};</div><div>convert_to_celsius({City, {f, F}}) -></div><div><span style="white-space: pre; "> </span>{City, {c, (F-32)*5/9}}.</div><div>print_temp({City, {c, C}}) -></div><div><span style="white-space: pre; "> </span>io:format("~p has a temperature of ~w C~n",[City,C]).</div><div>start() -></div><div><span style="white-space: pre; "> </span>Pid = spawn(?MODULE, format_temps, [{moscow,{f,-40}}, {bangalore,{f,40}}, {wellington, {c,24}}]),</div><div><span style="white-space: pre; "> </span>Pid.</div></span></div></blockquote></div><br></div></div></div></span>
</blockquote>
<div>
<br>
</div>
</div>
</div>