For loops don't count down

Hi --

···

On Tue, 20 Feb 2007, Robert Dober wrote:

On 2/19/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

Hi --

On Tue, 20 Feb 2007, Robert Dober wrote:

> On 2/19/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
>> Hi,
>>
>> In message "Re: For loops don't count down" >> >> on Tue, 20 Feb 2007 02:45:27 +0900, Daniel Schierbeck >> >> <daniel.schierbeck@gmail.com> writes:
>>
>> >Is there a necessity for a range such as 5..0 to be empty?
>>
>> 5..1 is the easiest case,
> No it is not, how could we distinguish between a "reversed" range and
> an "empty" range.
> but what if "abz".."abc" where we couldn't
>> define reasonable String#pred. Just raise error?
> With all due respect if we have a reasonable String#succ we can define
> a reasonable String#pred.

See the thread starting at ruby-talk 38910 for an earlier discussion
of this. It's not easy, and it's arbitrary and of questionable
usefulness. (I don't think ranges need to be any more array-like than
they already are -- possibly less.)

I do not like the lack of symmetry it just feels not right.

You should adopt my Ruby slogan:

   Ruby: the triumph of balance over symmetry.

:slight_smile:

David

--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black\)
    (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf\)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

Hi --

>> Hi --
>>
>> >> Hi,
>> >>
>> >> >Is there a necessity for a range such as 5..0 to be empty?
>> >>
>> >> 5..1 is the easiest case,
>> > No it is not, how could we distinguish between a "reversed" range and
>> > an "empty" range.
>> > but what if "abz".."abc" where we couldn't
>> >> define reasonable String#pred. Just raise error?
>> > With all due respect if we have a reasonable String#succ we can define
>> > a reasonable String#pred.
>>
>> See the thread starting at ruby-talk 38910 for an earlier discussion
>> of this. It's not easy, and it's arbitrary and of questionable
>> usefulness. (I don't think ranges need to be any more array-like than
>> they already are -- possibly less.)
>
> I do not like the lack of symmetry it just feels not right.

You should adopt my Ruby slogan:

   Ruby: the triumph of balance over symmetry.

:slight_smile:

It's easy when you are with the majority, do you remember the thread
about "receiver" though :wink: [ I still think you are right about that
one]
I kind of hope to be right with this one, but I am checking the thread now.
Cheers
Robert

···

On 2/19/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

On Tue, 20 Feb 2007, Robert Dober wrote:
> On 2/19/07, dblack@wobblini.net <dblack@wobblini.net> wrote:
>> On Tue, 20 Feb 2007, Robert Dober wrote:
>> > On 2/19/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
>> >> In message "Re: For loops don't count down" > >> >> on Tue, 20 Feb 2007 02:45:27 +0900, Daniel Schierbeck > >> >> <daniel.schierbeck@gmail.com> writes:

David

--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black\)
    (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf\)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous

> Hi --

It's easy when you are with the majority, do you remember the thread
about "receiver" though :wink: [ I still think you are right about that
one]
I kind of hope to be right with this one, but I am checking the thread now.
Cheers
Robert

Done.
But did you check it out?
Two facts:
It is 5 years old, and Matz said that Integer#prev was maybe not a good idea.
5 years later he has changed his mind and accepted the RCR about Integer#pred.

And I am not at all talking about that!!!

Am I as confusing as confused? [Gotta change the signature I guess]

Well just forget it for now I might have messed this thread up...

Cheers
Robert

···

On 2/19/07, Robert Dober <robert.dober@gmail.com> wrote:

On 2/19/07, dblack@wobblini.net <dblack@wobblini.net> wrote:
>
> David
>
> --
> Q. What is THE Ruby book for Rails developers?
> A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black\)
> (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf\)
> Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
> A. Ruby Power and Light, LLC (http://www.rubypal.com)
>

--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous

--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous

Hi --

> I do not like the lack of symmetry it just feels not right.

You should adopt my Ruby slogan:

   Ruby: the triumph of balance over symmetry.

:slight_smile:

It's easy when you are with the majority, do you remember the thread
about "receiver" though :wink: [ I still think you are right about that
one]
I kind of hope to be right with this one, but I am checking the thread now.

One example is:

   "09".succ # => "10"
   "9".succ # => "10"

   "10".pred # => ??

Since it's not a one-to-one mapping, the only way to go backwards is
to come up with arbitrary rules. That doesn't mean it's a bad idea,
but there's definitely no single clear way for it to work.

David

···

On Tue, 20 Feb 2007, Robert Dober wrote:

--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black\)
    (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf\)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

Hi --

>> > I do not like the lack of symmetry it just feels not right.
>>
>> You should adopt my Ruby slogan:
>>
>> Ruby: the triumph of balance over symmetry.
>>
>> :slight_smile:
> It's easy when you are with the majority, do you remember the thread
> about "receiver" though :wink: [ I still think you are right about that
> one]
> I kind of hope to be right with this one, but I am checking the thread
> now.

One example is:

   "09".succ # => "10"
   "9".succ # => "10"

I thought it was "a" :frowning:

   "10".pred # => ??

It would have been "09"
This is bad and there is no solution, good point again.
I guess I will deprecate String#succ in my programs
Thx for explaining it to me.

Since it's not a one-to-one mapping, the only way to go backwards is
to come up with arbitrary rules. That doesn't mean it's a bad idea,
but there's definitely no single clear way for it to work.

David

--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black\)
    (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf\)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

Robert

···

On 2/19/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

On Tue, 20 Feb 2007, Robert Dober wrote:

--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous