Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Alternate solution :

sage: vector(vector([1, 2, 3]).list()+vector([4, 5]).list())
(1, 2, 3, 4, 5)

HTH,

Alternate solution :

sage: vector(vector([1, 2, 3]).list()+vector([4, 5]).list())
(1, 2, 3, 4, 5)

Hence :

sage: def concatenate_vectors(*x):
....:     return vector(reduce(lambda a,b:a+b, map(lambda u:u.list(), x)))
....: 
sage: concatenate_vectors(vector([1, 2, 3]), vector([4, 5]), vector([6]))
(1, 2, 3, 4, 5, 6)

HTH,