>
> 4) It is more intuitive for new Ruby programmers who come from a
> Matlab/Octave/Python background.  I'm not sure how much weight this reason
> carries (maybe negative? :-))


I also contribute to NMatrix and I can guarantee that this is relevant, in
a positive way. :)


-----
Carlos Agarie
Software Engineer @ Geekie (geekie.com.br)
+55 11 97320-3878
@carlos_agarie


2013/10/24 David MacMahon <davidm / astro.berkeley.edu>

>
> 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
>
>