From: Intransition Date: 2012-03-19T04:57:02+09:00 Subject: Re: why no decreasing enumerations? ------=_Part_242_18030855.1332099973038 Content-Type: multipart/alternative; boundary="----=_Part_243_14514713.1332099973039" ------=_Part_243_14514713.1332099973039 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Sunday, March 18, 2012 3:17:55 PM UTC-4, Jan E. wrote: > > Well, I'm glad for his objections. I don't think we need another PHP > with all the data structures mixed together. ;-) I didn't say he did, not that "who knows". > Back on topic: I think it's actually a problem of mistakable syntax. It > looks like a short notation of a sequence. Like you would write > > 2,4,...,10 > > in mathematics. In fact, Haskell has this kind of list notation: > > [1..5] -- short for [1,2,3,4,5] > > Many Ruby beginners try to write this down in Ruby, too. But in Ruby, > the dot syntax describes a range, and a range isn't a sequence. > That is incorrect. Range is really more a sequence than it is an interval. (1..3).each{ |i| p i } 1 2 3 (1..3).to_a #=> [1,2,3] ('a'..'c').to_a #=> ['a', 'b', 'c'] [*1..3] #=> [1,2,3] Just look at how all the methods work: http://ruby-doc.org/core-1.9.3/Range.html Only `cover?` really expressly implies use as an interval. ------=_Part_243_14514713.1332099973039 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On Sunday, March 18, 2012 3:17:55 PM UTC-4, Jan E. wrote:Well, I'm glad for his objections. I don= 't think we need another PHP
with all the data structures mixed togethe= r. ;-)

 I didn't say he did, not that "who knows"= .
 
=

Back on topic: I think it's actually a problem of mistakable syntax. It =
looks like a short notation of a sequence. Like you would write

2= ,4,...,10

in mathematics. In fact, Haskell has this kind of list nota= tion:

[1..5]  -- short for [1,2,3,4,5]

Many Ruby beginners= try to write this down in Ruby, too. But in Ruby,
the dot syntax descr= ibes a range, and a range isn't a sequence.


That i= s incorrect.  Range is really more a sequence than it is an interval.<= br>
    (1..3).each{ |i| p i }
    1
&nbs= p;   2
    3

    (1..3).t= o_a  #=3D> [1,2,3]

    ('a'..'c').to_a  = #=3D> ['a', 'b', 'c']

    [*1..3]  #=3D> [= 1,2,3]


Just look at how all the methods work: http://ruby-doc.or= g/core-1.9.3/Range.html

Only `cover?` really expressly implies use a= s an interval.


------=_Part_243_14514713.1332099973039-- ------=_Part_242_18030855.1332099973038--