<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Some people like it like that.  The repitition on the RHS makes me
    think there's room for more streamlining.<br>
    <br>
    <div class="moz-cite-prefix">On 13/02/2019 15:02, Donald Steven
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:35a6da28-6e22-783a-f4b0-828cfd13ce63@aim.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Alas, that creates a different form of code sprawl, as in:<br>
      <br>
      <div style="color: #ffffff;background-color: #002451;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 16px;line-height: 22px;white-space: pre;"><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">left2right</span><span style="color: #ffffff;">,        [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">6</span><span style="color: #ffffff;">  </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">+</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">8</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">left2right</span><span style="color: #ffffff;">,        [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">12</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">+</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">4</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">left2right</span><span style="color: #ffffff;">,        [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">])                 </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">+</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">2</span><span style="color: #ffffff;">.</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">right2left</span><span style="color: #ffffff;">,        [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">6</span><span style="color: #ffffff;">  </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">8</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">right2left</span><span style="color: #ffffff;">,        [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">12</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">4</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">right2left</span><span style="color: #ffffff;">,        [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">])                 </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">2</span><span style="color: #ffffff;">.</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">rapidlyleft2right</span><span style="color: #ffffff;">, [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">6</span><span style="color: #ffffff;">  </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">+</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">16</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">rapidlyleft2right</span><span style="color: #ffffff;">, [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">12</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">+</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">8</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">rapidlyleft2right</span><span style="color: #ffffff;">, [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">])                 </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">+</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">4</span><span style="color: #ffffff;">.</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">rapidlyright2left</span><span style="color: #ffffff;">, [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">6</span><span style="color: #ffffff;">  </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">16</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">rapidlyright2left</span><span style="color: #ffffff;">, [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">]) </span><span style="color: #ebbbff;">when</span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;"><</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">12</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">8</span><span style="color: #ffffff;">;</span></div><div><span style="color: #bbdaff;">makePanPositionL</span><span style="color: #ffffff;">(</span><span style="color: #ff9da4;">Notes</span><span style="color: #ffffff;">, </span><span style="color: #d1f1a9;">rapidlyright2left</span><span style="color: #ffffff;">, [</span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;">|</span><span style="color: #ff9da4;">_</span><span style="color: #ffffff;">])                 </span><span style="color: #99ffff;">-></span><span style="color: #ffffff;"> </span><span style="color: #ff9da4;">Cur</span><span style="color: #ffffff;"> </span><span style="color: #99ffff;">-</span><span style="color: #ffffff;"> </span><span style="color: #ffc58f;">4</span><span style="color: #ffffff;">.</span></div></div>
      <br>
      <br>
      <div class="moz-cite-prefix">On 2/13/2019 8.35 AM, Jesper Louis
        Andersen wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:CAGrdgiWHe+weXUJiaFTrw3EKAadSeMWVsNRG8S_M_C80J9pCow@mail.gmail.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div class="gmail_default"
                style="font-family:arial,helvetica,sans-serif">On Wed,
                Feb 13, 2019 at 1:51 PM Ivan Uemlianin <<a
                  href="mailto:ivan@llaisdy.com" moz-do-not-send="true">ivan@llaisdy.com</a>>
                wrote:<br>
              </div>
            </div>
            <div class="gmail_quote">
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">This might be
                cheating but I would avoid the branching altogether if <br>
                poss., eg:<br>
                <br>
                     PanPosition = CurrentPanPosition +
                notes_to_pad(Notes),<br>
                     ...<br>
                <br>
                     notes_to_pad(N) where N <  6 -> 8;<br>
                     notes_to_pad(N) where N < 12 -> 4;<br>
                     notes_to_pad(_)              -> 2.<br>
                <br>
              </blockquote>
              <div><br>
              </div>
              <div>makePanPositionL(Notes, left2right, [Cur|_]) when
                Notes < 6  -> Cur + 8;<br>
                makePanPositionL(Notes, left2right, [Cur|_]) when Notes
                < 12 -> Cur + 4;<br>
                makePanPositionL(Notes, left2right,
                [Cur|_])                 -> Cur + 2.</div>
              <div><br>
              </div>
              <div>
                <div style="font-family:arial,helvetica,sans-serif"
                  class="gmail_default">You can just lift everything
                  into a pattern match for this piece of code, which is
                  what I think I'd do. It makes the result far more
                  tabular, which in some cases is easier to read. There
                  may be other reasons in the code to not do this, but
                  as it was written, I think I'd pick the above as the
                  solution. YMMV of course.</div>
                <br>
              </div>
            </div>
          </div>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org" moz-do-not-send="true">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions" moz-do-not-send="true">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
      </blockquote>
      <br>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
============================================================
Ivan A. Uemlianin PhD
Llaisdy

Ymchwil a Datblygu Technoleg Lleferydd
Speech Technology Research and Development

                    <a class="moz-txt-link-abbreviated" href="mailto:ivan@llaisdy.com">ivan@llaisdy.com</a>
                        @llaisdy
                         llaisdy.wordpress.com
              github.com/llaisdy
                     <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/ivanuemlianin">www.linkedin.com/in/ivanuemlianin</a>

                        festina lente
============================================================ </pre>
  </body>
</html>