<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Checking for divisibility is very common:<div class=""><br class=""></div><div class=""> <span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">21</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> % </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">3</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> == </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">0</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(203, 203, 203);">// true</span></div><div class=""><br class=""></div><div class="">In fact, this is such a common use of the `<span class="" style="font-family: 'Source Code Pro'; font-size: 12px;">%</span>` operator that the `<span class="" style="font-family: 'Source Code Pro'; font-size: 12px;">== </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">0</span>` side of the expression seems distracting in this use case. For quite a while now, I’ve been using a custom operator for this, which is steadily growing on me:</div><div class=""><br class=""></div><div class=""> <span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">21</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(145, 84, 15);">%==</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">3</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> </span><span class="" style="color: rgb(203, 203, 203); font-family: 'Source Code Pro'; font-size: 12px;">// true</span></div><div class=""><br class=""></div><div class="">… which also allows me to overload it for sequences:</div><div class=""><br class=""></div><div class=""> <span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">21</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(145, 84, 15);">%==</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;"> [</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">7</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;">, </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(255, 38, 0);">3</span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px;">] </span><span class="" style="font-family: 'Source Code Pro'; font-size: 12px; color: rgb(203, 203, 203);">// true</span></div><div class=""><br class=""></div><div class="">(If I’m inadvertently misusing this mailing list to share such a minor idea, please tell me off so that I can learn not to do it again!)</div><div class=""><br class=""></div><div class="">milos</div></body></html>