abrudz / aplcart

A novel approach to finding your way in APL
https://aplcart.info/
Other
133 stars 18 forks source link

Are the range functions misleading? #100

Closed rikedyp closed 2 years ago

rikedyp commented 2 years ago

When searching for things like "inclusive range" or "within range" you are met with some functions using interval index ⍺⍸⍵.

https://aplcart.info/?q=inclusive%20range#

However, it is much faster, and in my opinion more direct, to express these ideas with Boolean logic functions

      3 5{(⍵≥1⌷⍺)∧⍵≤2⌷⍺}3 5⍴⍳10
0 0 1 1 1
0 0 0 0 0
0 0 1 1 1
      3 5(1=4 9⍸⍳+3×⍸)3 5⍴⍳10
0 0 1 1 1
0 0 0 0 0
0 0 1 1 1

so unless there's a specific reason why these entries are like this, I suggest either replacing or adding Fast: versions using Boolean functions.