HaloO Eric,

you wrote:
#strictly outside
($a >  3..6) === (3 >  $a >  6) === (3 >  $a || $a >  6)


Just looking at that hurts my head, how can $a be smaller than three
and larger than 6?  That doesn't make even a little since.

To my twisted brain it does ;)

The idea is that
   outside === !inside
           === !($a < 3..6)
           === !(3 < $a < 6)
           === !(3 < $a && $a < 6)
           === !(3 < $a) || !($a < 6)  # DeMorgan of booleans
           ===  3 >= $a || $a >= 6

Well, stricture complicates the picture a bit.

  strictly outside === !strictly !inside

that is also the case if comparison operators could be
negated directly

  > === !<=
    === !( < || == )
    === !< && !=
    === >= && !=

We could write that as operator junctions

 infix:{'>'}  ::= none( infix:{'<'}, infix:{'=='} )
 infix:{'>='} ::= any(  infix:{'>'}, infix:{'=='} )


($a >  3..6) === ($a < 3 || $a > 6)

I would write that ($a < 3 || 6 < $a) which is just the flipped
version of my (3 > $a || $a > 6) and short circuit it to (3 > $a > 6).
That makes doubled > and < sort of complementary orders when you think
of the Nums as wrapping around from +Inf to -Inf. In fact the number
line is the projection of the unit circle. In other words the range
6..3 might be considered as the inverse of 3..6, that is all real
numbers outside of 3..6 not including 3 and 6.


Your intermediate step makes no sense at all.  I would think that (and expect)

($a >  3..6) === ($a > 6);

You could always use.

my $range = 3..6;
if ($range.min < $a < $range.max) == inside
if ($range.min > $a || $a > $range.max) == outisde

Then you don't have to warp any meaning  of > or <, sure its longer
but its obvious to anyone exactly what it means.

With Juerd's remark of using ~~ and !~ for insideness checking on ranges
I think using < and <= to mean completely below and and > and >= meaning
completely above in the order there remains to define what == and !=
should mean. My current idea is to let == mean on the boundary and !=
then obviuosly everything strictly inside or outside. But it might also
be in the spirit of reals as used in maths to have no single Num $n
beeing equal to any range but the zero measure range $n..$n. This makes
two ranges equal if and only if their .min and .max are equal.

This gives the set of 4 dualing pairs of ops

     <   <=  ==  ~~

     >=  >   !=  !~     # negation of the above


The driving force behind this real ranges thing is that I consider
nums in general as coroutines iterating smaller and smaller intervalls
around a limit. That actually is how reals are defined! And all math
functions are just parametric versions of such number iterating subs.

Writing programs that implement certain nums means adhering to a number
of roles like Order which brings in < and > or Equal which requires == and != taken together also give <= and => and <=>. Finally, role Range
brings in .., ~~ and !~ for insideness checking.

Role Division is actually very interesting because there are just the 4
division algebras of the Reals, Complex, Quaternions and Octonions.

Sorry, if this is all too far off-topic.
--

Reply via email to