Yes,<div>naming has been my major problem with this...in fact to be complete</div><div>the name should take into account that with the above definition the</div><div>interval is right open</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>coerceRangeToRightOpenIntervalFrom:to:</div></blockquote>verbose, uh?<div>But if we want to implement the complementary definition</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>x mod (a .. b]</div></blockquote>there is the need for such distinction.<div>Given the following property</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>
x mod (a .. b]  = x mod [b .. a)</div></blockquote>the implementation is trivial:<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>Number&gt;&gt;coerceRangeToLeftOpenIntervalFrom:min to: max</div>
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>&quot;x mod (a .. b]  = x mod [b .. a)&quot;</div>
</blockquote></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><br></div><div>^self coerceRangeToRightOpenIntervalFrom:max to: min</div></blockquote></blockquote><div><br><div><div><div><br></div><div>coerceRangeToRightIntervalFrom:to: could be a very nice addition for Point (and classes implementing \\?)</div>
<div>to make things like the following possible:</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>(110@120) coerceToRangeFrom: (11@71) to: (50@60) .  -&gt;  32@65</div>
</div></blockquote><div><br></div><div>i.e. like having an infinite space and recenter position within the view bounds</div><div>see</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>Morph&gt;&gt;wrap where newX and newY are set.</div></blockquote><div><br></div>Another example for wrapping:<br><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>
TextMorph&gt;&gt;cursorWrapped:  (this is not with Point)</div></blockquote><div><br></div><div><br></div><div>Now the name is hard to select!</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>inInterval:</div><div>inRightOpenInterval:</div><div>withinInterval:</div><div>withinRightOpenInterval</div><div>...</div></blockquote><div><br></div><div>I personally do not dislike nRightOpenInterval:</div><div><br>
</div><div>Bye</div><div>Enrico<br><div><div><br><div class="gmail_quote">On Sat, Apr 24, 2010 at 21:44, Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2010/4/24 Stéphane Rollandin &lt;<a href="mailto:lecteur@zogotounga.net">lecteur@zogotounga.net</a>&gt;:<br>
<div><div></div><div class="h5">&gt;&gt; Hmm... #coerceToInterval: sounds like converting something into an<br>
&gt;&gt; instance of Interval..<br>
&gt;&gt; so, maybe there could be some other names, like<br>
&gt;&gt;  #putOnInterval:<br>
&gt;&gt;  #withinInterval:<br>
&gt;&gt;<br>
&gt;&gt; 359 withinInterval: (-90 to: 90)<br>
&gt;<br>
&gt; 359 moduloInterval: (-90 to: 90)   ?<br>
&gt;<br>
<br>
</div></div>+1<br>
<br>
&gt; Stef<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Enrico Spinielli<br>&quot;Do Androids dream of electric sheep?&quot;— Philip K. Dick<br>&quot;Hear and forget; see and remember;do and understand.&quot;—Mitchel Resnick<br>

</div></div></div></div></div></div>