From: mortee Date: 2007-10-13T01:42:21+09:00 Subject: Re: range max Brian Adkins wrote: > On Oct 12, 8:56 am, Yossef Mendelssohn wrote: >> On Oct 11, 9:55 pm, Brian Adkins wrote: >> I was thinking Range#last, but that has the same problem as Range#end >> (probably one is an alias for the other). >> >> (1..10).last (or end) => 10 >> (1..10).max => 10 >> >> (1...10).last (or end) => 10 >> (1...10).max => 9 >> >> What you want is something like > > Actually, what you want is simply N. It's a nonsensical request from a > troll. Using max, end, last, etc. to find the end of the range is > ridiculous since you must know the end of the range to define the > range! Ehhh... it's actually quite probable that the OP was indeed just insult - however, you all seem to assume that the same person provides both the range and wants to know its max. If e.g. you write a method, which accepts various types of arguments, then you can't know in advance if it'll be a range, array or something else. So you have to use #max - and then one might expect that a range (however big the span is) can compute it in constant time. So the OP had *some* validity, while this still doesn't have anything to do with the quality of the language itself. Just one spot where the it might possibly be enhanced a bit. mortee