[#407] New feature for Ruby? — Clemens.Hintze@...

Hi all,

27 messages 1999/07/01
[#413] Re: New feature for Ruby? — matz@... (Yukihiro Matsumoto) 1999/07/01

Hi Clemens,

[#416] Re: New feature for Ruby? — Clemens Hintze <c.hintze@...> 1999/07/01

On Thu, 01 Jul 1999, Yukihiro Matsumoto wrote:

[#418] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/01

Hi

[#426] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/02

Hi,

[#440] Now another totally different ;-) — Clemens Hintze <c.hintze@...>

Hi,

21 messages 1999/07/09
[#441] Re: Now another totally different ;-) — matz@... (Yukihiro Matsumoto) 1999/07/09

Hi,

[#442] Re: Now another totally different ;-) — Clemens Hintze <c.hintze@...> 1999/07/09

On Fri, 09 Jul 1999, you wrote:

[#443] — Michael Hohn <hohn@...>

Hello,

26 messages 1999/07/09
[#444] interactive ruby, debugger — gotoken@... (GOTO Kentaro) 1999/07/09

Hi Michael,

[ruby-talk:00411] Re: New feature for Ruby?

From: matz@... (Yukihiro Matsumoto)
Date: 1999-07-01 07:29:42 UTC
List: ruby-talk #411
Hi,

In message "[ruby-talk:00408] Re: New feature for Ruby?"
    on 99/07/01, Julian R Fondren <julian@cartotech.com> writes:

|> - Range::new(1, 9, -2) -- ERROR!
|Perhaps you should try the latest version of ruby, the absolute value of
|the third argument is used, and this works fine.

Range::new() takes tree arguments in the latest, but the third
argument is the boolean value to specify exclude last item, so that:

  Range::new(1,9,false) # 1<=n<=9; default
  Range::new(1,9,true)  # 1<=n<9;

|> The call "Range::new(1, 9)" or "Range::new(9, 1)" could also be
|> written as "1..9" and "9..1" (perhaps we could have a global function
|> "range" (like Python) which would instantiate Ranges via Range::new?).
|This is already true.
|``for x in 1..9; print "#{x}\n"; end'' works as expected

But not for reverse order; 

  for x in 9..1; print "#{x}\n"; end

will not work as many (well, at least Clemens) expect.

But I think Range is designed to be that way, i.e, no reverse order,
option to exclude last element.  I believe there can be something like
Interval class which is like Smalltalk's Interval.

                                                matz.

In This Thread