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>>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>"x mod (a .. b] = x mod [b .. a)"</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) . -> 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>>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>>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"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>></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 <<a href="mailto:lecteur@zogotounga.net">lecteur@zogotounga.net</a>>:<br>
<div><div></div><div class="h5">>> Hmm... #coerceToInterval: sounds like converting something into an<br>
>> instance of Interval..<br>
>> so, maybe there could be some other names, like<br>
>> #putOnInterval:<br>
>> #withinInterval:<br>
>><br>
>> 359 withinInterval: (-90 to: 90)<br>
><br>
> 359 moduloInterval: (-90 to: 90) ?<br>
><br>
<br>
</div></div>+1<br>
<br>
> Stef<br>
><br>
><br>
><br>
><br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Enrico Spinielli<br>"Do Androids dream of electric sheep?"— Philip K. Dick<br>"Hear and forget; see and remember;do and understand."—Mitchel Resnick<br>
</div></div></div></div></div></div>