1 | initial version |
Alternate solution :
sage: vector(vector([1, 2, 3]).list()+vector([4, 5]).list())
(1, 2, 3, 4, 5)
HTH,
2 | No.2 Revision |
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,