<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">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 class="Apple-interchange-newline">
</div>
<br><div><div>On 22 Jun 2011, at 11:03, Sid Carter wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-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 class="Apple-tab-span" style="white-space: pre; "> </span>ok;</div><div>format_temps([City|Rest]) -></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>print_temp(convert_to_celsius(City)),</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>format_temps(Rest). </div><div>convert_to_celsius({City, {c, C}}) -></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>{City, {c, C}};</div><div>convert_to_celsius({City, {f, F}}) -></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>{City, {c, (F-32)*5/9}}.</div><div>print_temp({City, {c, C}}) -></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>io:format("~p has a temperature of ~w C~n",[City,C]).</div><div>start() -></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>Pid = spawn(?MODULE, format_temps, [{moscow,{f,-40}}, {bangalore,{f,40}}, {wellington, {c,24}}]),</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>Pid.</div></span></blockquote></div><br></div></body></html>