From: "Mauricio Fernández" Date: 2003-02-13T17:33:54+09:00 Subject: Re: Range#length? On Thu, Feb 13, 2003 at 01:07:37PM +0900, William Djaja Tjokroaminata wrote: > Hi Matz, > > I was taking the point from ahoward, which said > > "what would be the last_member of (0.0 ... 42.0) ??" > > In any Advanced Calculus or Real Analysis course, they introduced the > concept of "Supremum" (sup) which is the smallest upper bound and > "Infinum" (inf) which is the greatest lower bound. A smallest upper bound > that belongs to the set is also called Maximum, and similarly, a greatest > lower bound that belongs to the set is also called Minimum. > > Therefore, (0.0 .. 42.0).max == 42.0 but (0.0 ... 42.0).max does not > exist. However, (0.0 .. 42.0).sup and (0.0 ... 42.0).sup both exist and > are equal to 42.0. > > For a quick, more formal treatment of the subject, we can read e.g. > > http://www.math.purdue.edu/~rcp/11_sup-inf_public.pdf > > I am sorry if I am being too formal mathematically; I was only responding > to ahoward's points. This is mathematically sound, but in which context would you use it? All our problems come from trying to define ranges over compact metric spaces (although floats really aren't). A way to differentiate would be introducing a new notation 'a'..'b' 'a'...'b' 1.0 -- 2.0 1.0 --- 2.0 compact and warnings when Ruby realizes you're mistaken in your choice of range. They easiest way to find whether '..' or '--' are right would be testing for #succ. This is however ugly and I'd stay with what we have now. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com <|ryan|> I don't use deb u poor man netgod: heh apt-get install task-p0rn