<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hello,</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">You are using atoms instead of variables in your program. Erlang variables starts with capital letter.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">The receive loop cannot match your message:</div><div id="AppleMailSignature"><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"> {From, {insert, key, value}} -></span></font></blockquote></div><div id="AppleMailSignature">It expects one triple of atoms but you send different one.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">test:interact(Pid, {insert, testkey, testvalue}).</span></font></blockquote><div id="AppleMailSignature"><br></div>Dmitry<br><br>Sent from my iPhone</div><div><br>On 15 Mar 2016, at 00:53, Pietro <<a href="mailto:pulsarpietro@posteo.net">pulsarpietro@posteo.net</a>> wrote:<br><br></div><blockquote type="cite"><div><span>Hi all,</span><br><span></span><br><span>I have recently started to implement a small academic project in Erlang</span><br><span>and I have bumped into a problem which seems to show to myself I haven't</span><br><span>grasped something important about the technology itself.</span><br><span></span><br><span>That's my code :</span><br><span></span><br><span>-module(test).</span><br><span>-export([start/0, interact/2]).</span><br><span></span><br><span></span><br><span>start() -></span><br><span> spawn (fun() -> startloop() end).</span><br><span></span><br><span></span><br><span>interact(Pid, Request) -></span><br><span> Pid ! {self(), Request},</span><br><span> receive </span><br><span> {Pid, Response} -> Response</span><br><span> end.</span><br><span></span><br><span></span><br><span>startloop() -></span><br><span> TableId = ets:new(dictionary, [set]),</span><br><span> loop(TableId).</span><br><span></span><br><span>loop(Table) -></span><br><span> receive</span><br><span> {From, {insert, key, value}} -></span><br><span> From ! ets:insert(Table, {key, value}),</span><br><span> loop(Table);</span><br><span> {From, {lookup, key}} -></span><br><span> From ! ets:lookup(Table, key),</span><br><span> loop(Table);</span><br><span> Any -></span><br><span> Any</span><br><span> </span><br><span> end.</span><br><span></span><br><span></span><br><span>The problem happens when I try to interact with the server I start using</span><br><span>the command:</span><br><span></span><br><span>Pid = test:start().</span><br><span></span><br><span>Then I run :</span><br><span></span><br><span>test:interact(Pid, {insert, testkey, testvalue}).</span><br><span></span><br><span>My ershell at this point hangs and nothing happens ... what is happening</span><br><span>? Please feel free to redirect me to a more appropriate newsgroup if my</span><br><span>question is not appropriate or if there is a better one.</span><br><span></span><br><span>Thanks in advance.</span><br><span></span><br><span>Pietro.</span><br><span></span><br><span>_______________________________________________</span><br><span>erlang-questions mailing list</span><br><span><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a></span><br><span><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br></div></blockquote></body></html>