<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Thanks Vlad, that works. However, there are really 3 orbiters
and I need to use the values of X1, Y1, Z1, X2, Y2, Z2, and X3, Y3
and Z3 outside of the 'receive', to compare them, calculate
distances between points, etc.<br>
<br>
When I try:<br>
<br>
loop(Orbiter1, Orbiter2, Orbiter3) -><br>
<br>
receive<br>
{Orbiter1, Coordinates = {{X1, Y1, Z1}}} ->
% the io:format statements are just fro debugging. What I
really need<br>
io:format("Coordinates: ~p~n", [Coordinates]),
% are the X1, Y1, and Z1 coordinates so that I can do some
work with them<br>
io:format("X1: ~p, Y1: ~p, Z1: ~p~n", [X1, Y1,
Z1]); % beyond the end of the 'receive'<br>
{Orbiter2, Coordinates = {{X2, Y2, Z2}}} -> <br>
io:format("Coordinates: ~p~n", [Coordinates]),<br>
io:format("X2: ~p, Y2: ~p, Z2: ~p~n", [X2, Y2, Z2]);<br>
{Orbiter3, Coordinates = {{X3, Y3, Z3}}} -> <br>
io:format("Coordinates: ~p~n", [Coordinates]),<br>
io:format("X3: ~p, Y3: ~p, Z3: ~p~n", [X3, Y3, Z3]);<br>
_ -><br>
ok % stop if unknown message arrives<br>
end,<br>
<br>
io:format("X1: ~p, Y1: ~p, Z1: ~p~n", [X1, Y1, Z1]), %
this would really be more substantial code. This is a placeholder<br>
loop(Orbiter1, Orbiter2, Orbiter3).<br>
<br>
=================<br>
<br>
I get:<br>
<br>
problem.erl:48: variable 'X1' unsafe in 'receive' (line 34)<br>
problem.erl:48: variable 'Y1' unsafe in 'receive' (line 34)<br>
problem.erl:48: variable 'Z1' unsafe in 'receive' (line 34)<br>
{"init terminating in
do_boot",{undef,[{problem,main,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}<br>
init terminating in do_boot ()<br>
<br>
=================<br>
<br>
but if I move the 'loop(Orbiter1, Orbiter2, Orbiter3)' statement
back within the clauses in 'receive', it never reaches the code
beyond 'end,'.<br>
<br>
&^(**(^(*(&\&%$^&%$%^$!!!!<br>
<br>
In everyday English, I want to:<br>
<br>
1. Get the X, Y and Z coordinates from each Orbiter (the
concurrent processes that are producing them (verified correctly))<br>
2. Do some work with the coordinates (e.g., calculating how far
apart the orbiters are)<br>
<br>
Don<br>
</p>
<br>
<div class="moz-cite-prefix">On 09/29/2016 11:02 AM, Vlad Dumitrescu
wrote:<br>
</div>
<blockquote
cite="mid:CAA-EFXu4fQPoSEMbd8cOgbYoN8jVZbP9XDGxGYXFz=A_AC9X1Q@mail.gmail.com"
type="cite">
<div><span style="font-size:12.8px">loop(Orbiter1) -></span><br
style="font-size:12.8px">
<span style="font-size:12.8px"> receive</span><br
style="font-size:12.8px">
<span style="font-size:12.8px"> {Orbiter1,
Coordinates={{X,Y,Z}}} -> </span><br
style="font-size:12.8px">
<span style="font-size:12.8px">
io:format("Coordinates: ~p~n", [Coordinates]),</span><br
style="font-size:12.8px">
<span style="font-size:12.8px"> io:format("X: ~p, Y:
~p, Z: ~p~n", [X, Y, Z]),</span></div>
<div>
<div><span style="font-size:12.8px"><span
style="font-size:12.8px"> loop(Orbiter1);</span><br
style="font-size:12.8px">
</span></div>
<div><span style="font-size:12.8px"><span
style="font-size:12.8px"> _ -></span></span></div>
<div> ok % stop if unknown message arrives</div>
<span style="font-size:12.8px"> end.</span></div>
</blockquote>
<br>
</body>
</html>