From: Everett L Williams II Date: 2010-12-28T19:37:21+09:00 Subject: Re: Numeric comparison with nil - Math masochists only!! --------------010206060902070604060400 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit serialhex wrote: > hey robert, thanks for the great article, i'll keep that stuff in mind as > i'm writing the rest of this class! > > hex > > On Mon, Dec 27, 2010 at 5:46 AM, Robert Klemme > wrote: > > >> On Sat, Dec 25, 2010 at 2:34 AM, serialhex wrote: >> >>> Colin, your amazing insight has led me to programming greatness!!! >>> >>> ...ok, mabye not so much, but i have (mostly) solved the problem using >>> >> the >> >>> Delegate class, heres the relevant code: >>> >>> ## >>> require 'delegate' >>> >>> class SurrealNil< DelegateClass(NilClass) >>> include Comparable >>> def<=> other >>> return -1 >>> end >>> def initialize >>> super nil >>> end >>> end >>> ## >>> >>> it returns -1 all the time so no matter what you compare it against it's >>> less than that (i mean, sereously, an empty set is WAAAAYYYYYYY less than >>> neg infinity, cause with neg infinity you still have SOMETHING right?) >>> >>> so while the rest of the project is FAR from finished, at least this part >>> >> is >> >>> completed. thanks for the help!! >>> >> If you need additional input I have written about numeric classes in our >> blog >> >> http://blog.rubybestpractices.com/posts/rklemme/019-Complete_Numeric_Class.html >> >> Kind regards >> >> robert >> >> -- >> remember.guy do |as, often| as.you_can - without end >> http://blog.rubybestpractices.com/ >> >> >> > > I can't imagine where you got the idea that a nul is less than minus infinity. Mathematically, a null is basically undefined as in dividing by zero. I have no idea what your use of this is, but mathematically you are in the wrong pew. Everett L.(Rett) Williams II --------------010206060902070604060400--