This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View file

@ -0,0 +1,14 @@
#include <vector>
#include <iostream>
int main()
{
std::vector<int> a(3), b(4);
a[0] = 11; a[1] = 12; a[2] = 13;
b[0] = 21; b[1] = 22; b[2] = 23; b[3] = 24;
a.insert(a.end(), b.begin(), b.end());
for (int i = 0; i < a.size(); ++i)
std::cout << "a[" << i << "] = " << a[i] << "\n";
}

View file

@ -0,0 +1,13 @@
#include <vector>
#include <iostream>
int main() {
std::vector<int> a {1, 2, 3, 4};
std::vector<int> b {5, 6, 7, 8, 9};
a.insert(a.end(), b.begin(), b.end());
for(int& i: a) std::cout << i << " ";
std::cout << std::endl;
return 0;
}

View file

@ -0,0 +1,9 @@
#APPTYPE CONSOLE
DIM aint[] ={1, 2, 3}, astr[] ={"one", "two", "three"}, asng[] ={!1, !2, !3}
FOREACH DIM e IN ARRAYMERGE(aint, astr, asng)
PRINT e, " ";
NEXT
PAUSE

View file

@ -1,5 +1,9 @@
a = [1,2,3]
b = [4,5,6]
ab = [a,b]
#alternative
# the above bracket notation simply generates a call to vcat
ab = vcat(a,b)
# hcat is short for `horizontal concatenation`
ab = hcat(a,b) #ab -> 3x2 matrix
# the append!(a,b) method is mutating, appending `b` to `a`
append!(a,b) # a now equals [1,2,3,4,5,6]