> Lett E S <eero.saynatkari / kolumbus.fi>
> Aihe: Re: nil question
> 
> > Lett E S <eero.saynatkari / kolumbus.fi>
> > Aihe: Re: nil question
> > 
> > > Lett "David A. Black" <dblack / wobblini.net>
> > > Aihe: Re: nil question
> > > 
> > > Hi --
> > > 
> > > On Mon, 31 Jan 2005, Christian Neukirchen wrote:
> > > 
> > > > "David A. Black" <dblack / wobblini.net> writes:
> > > >
> > > >> Hi --
> > > >>
> > > >> On Sun, 30 Jan 2005, Christian Neukirchen wrote:
> > > >>
> > > >>> "William James" <w_a_x_man / yahoo.com> writes:
> > > >>>
> > > >>>> Sam Roberts wrote
> > > >>>>> In ruby, zero and empty strings are true
> > > >>>>
> > > >>>> Since 0 is true, you should be able to do this in Ruby:
> > > >>>>
> > > >>>> puts "yes" if -5 < x < 9
> > > >>>>
> > > >>>> The phrase '-5 < x' should yield the value of x instead of true.
> > > >>>> That's the way it actually works in the Icon programming language.
> > > >>>> But we have to use the klunky
> > > >>>>
> > > >>>> puts "yes" if -5 < x and x < 9
> > > >>>>
> > > >>>
> > > >>> Erm, say, x is -16:
> > > >>>
> > > >>> (-5 < x) < 9
> > > >>> (-5 < -16) < 9
> > > >>> -5 < 9
> > > >>> -5
> > > >>>
> > > >>> -5 is true, probably not what you want.
> > > >>
> > > >> But -5 < -16 is not true, so it wouldn't get that far.  (I assume
> > > >> William means it should return x if the expression is true, false
> > > >> otherwise.)
> > > >
> > > > So false is bigger than 9?  Math books will need to be rewritten. :-)
> > > 
> > > I assume the expression would short-circuit once one of the
> > > sub-expressions returned false, since
> > > 
> > >    x < y < z
> > > 
> > > cannot be true unless x < y.  So there would never be a false < z
> > > comparison.

[Snip my inanities]

Wow. I'm so dense today no wonder I've had stuff hurling towards me. Wonder if I could patent a caffeine capsule that starts dissolving 
after 6-7 hours?

Anyway. Looks like Fixnum and Float define < and >, whereas Bignum
and Complex only define <=>

module MultiComparable
  def <(val)
    val if self.<=>(val) == -1
    false
  end
  def >(val)
    val if self.<=>(val) == 1
    false
  end
end

# Modify the existing units
class FalseClass
  def <(val)
    false
  end
end

class Fixnum;  include MultiComparable; end
class Bignum;  include MultiComparable; end
class Float;   include MultiComparable; end
class Complex; include MultiComparable; end

Would that do it (this is real XP, I don't even have a compiler:)?

E