From: David MacMahon Date: 2013-10-24T10:39:27-07:00 Subject: [ruby-core:58026] Re: [ruby-trunk - Feature #9049] Shorthands (a:b, *) for inclusive indexing On Oct 24, 2013, at 1:24 AM, Eregon (Benoit Daloze) wrote: > @david_macmahon What about (1..5).step(2).to_a ? The problem is that it creates a Range, and Enumerator, and an Array (plus it's textually long). That's two extra objects compared to just creating a Range and the Array could be very large. Which of the following would you rather do? ```ruby r = 1:12:1e6 # Create Range with step_size 12. r[42] # Computes 1+12*42. ``` or ```ruby a = (1..1e6).step(12).to_a # Create Range, # create Enumerator, # and expand to largish Array. a[42] # Get element 42 from the array. ``` Dave