<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">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>