mlandistest / code

2 stars 0 forks source link

Vector concatenation [sf#24] #36

Open mlandis opened 10 years ago

mlandis commented 10 years ago

Reported by hoehna on 2013-11-11 10:12 UTC We really need a function for concatenating vectors. Should we implement a function like c() or overload the '+' operator for vectors (the latter is probably not a good idea)?

mlandis commented 10 years ago

Commented by michaellandis on 2014-07-02 01:08 UTC I think we should reserve '+' for vector arithmetic (see Feature Request #25).

In R, you can concatenate vectors such that c(c(1,2),3) returns c(1,2,3). The downside is you cannot nest vectors inside vectors. Fortunately, R also has matrix and array objects for higher-dimensional objects. (Rev does not currently appear to support vectors-of-vectors or have a matrix object.)

A concat function that accepts ordered arguments of vectors as arguments would work nicely.

e.g.

x<-concat(v(1,2),v(3,4),v(5,6)) x [ 1, 2, 3, 4, 5, 6 ]