<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Thanks Vlad, I'll give it a whirl!<br>
    <br>
    <div class="moz-cite-prefix">On 9/29/2016 2:53 PM, Vlad Dumitrescu
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAA-EFXsGokPpePhXjvANFdqDYKXrEtTGOgMUSc3+_nLvQGCBSw@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Donald,
        <div><br>
        </div>
        <div>I see. If you need to do processing that involves all three
          sets of coordinates, you can't do it like that because after
          each receive you can only know one set, the one just received.
          You have to keep the coords in  the server state. This is a
          simple alternative (sorry for the short names). </div>
        <div><br>
        </div>
        <div>% State is [{Orbiter1, {X1, Y1, Z1}}, ...]</div>
        <div>orbiter(State) -><br>
        </div>
        <div>    receive </div>
        <div>        {O, C} -></div>
        <div>            State1 = updateState(State, {O, C}),</div>
        <div>            process_state(State1),<br>
        </div>
        <div>            orbiter(State1);</div>
        <div>        _ -></div>
        <div>           % something</div>
        <div>           ok</div>
        <div>    end.</div>
        <div><br>
        </div>
        <div>This is quite standard simple server, I suggest you check a
          good introduction to that. <a moz-do-not-send="true"
            href="http://learnyousomeerlang.com/">http://learnyousomeerlang.com/</a>
          is my favorite.</div>
        <div><br>
        </div>
        <div>regards,</div>
        <div>Vlad</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Sep 29, 2016 at 6:29 PM, Donald
          Steven <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:t6sn7gt@aim.com" target="_blank">t6sn7gt@aim.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div 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>
                <span class="">             io:format("Coordinates:
                  ~p~n", [Coordinates]),<br>
                </span>             io:format("X2: ~p, Y2: ~p, Z2:
                ~p~n", [X2, Y2, Z2]);<br>
                        {Orbiter3, Coordinates = {{X3, Y3, Z3}}} -> <br>
                <span class="">             io:format("Coordinates:
                  ~p~n", [Coordinates]),<br>
                </span>             io:format("X3: ~p, Y3: ~p, Z3:
                ~p~n", [X3, Y3, Z3]);<span class=""><br>
                          _ -><br>
                              ok % stop if unknown message arrives<br>
                </span>     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,<wbr>main,[],[]},{init,start_em,1,[<wbr>]},{init,do_boot,3,[]}]}}<span
                  class=""><br>
                  init terminating in do_boot ()<br>
                  <br>
                </span> =================<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>
              <span class=""> <br>
                <div>On 09/29/2016 11:02 AM, Vlad Dumitrescu wrote:<br>
                </div>
              </span>
              <blockquote type="cite">
                <div><span style="font-size:12.8px">loop(Orbiter1) -></span><span
                    class=""><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></span></div>
                <span class="">
                  <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>
                </span></blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                This email has been checked for viruses by Avast antivirus software.
                                <br><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">www.avast.com</a>
                        </p>
                </td>
        </tr>
</table>
<br />
</body>
</html>