[Rd] [R] Successive subsets from a vector?

hadley wickham h.wickham at gmail.com
Wed Aug 23 13:46:31 CEST 2006


> > Providing the ability to write assignment functions that don't duplicate
> > is a more urgent problem.
>
> You mean, for end-users?  It can be done via primitives.

Isn't this sort of a run-time optimisation?  I thought R generally
followed the functional programming model of immutable objects, copy
on modification.

As a general comment/question - it seems to me the R seems to be
moving away from a functional paradigm to be more OO (especially among
package developers).

> As I said in my reply on R-help, I don't see the original as at all a
> common problem.  About the only times where a bound on number of entries
> is unknown in advance is when reading from a connection (and there the
> internal code does uses doubling strategies), and in a iterative procedure
> with no limit on the number of iterations (not usually good practice).

Agreed - but it is a very common mistake, and this change could bring
large performance increases to any written in this way.  Of course,
you can only protect users from themselves to some extent, and I can
imagine many things that would be both more interesting to work on and
provide performance benefits for people who understand more about how
vectors work.

Regards,

Hadley



More information about the R-devel mailing list