Task

Show how to concatenate two arrays in your language.



If this is as simple as array1 + array2, so be it.




*       # Concatenate 2 arrays (vectors)
        define('cat(a1,a2)i,j') :(cat_end)
cat     cat = array(prototype(a1) + prototype(a2))
cat1    i = i + 1; cat<i> = a1<i> :s(cat1)
cat2    j = j + 1; cat<i - 1 + j> = a2<j> :s(cat2)f(return)
cat_end
 
*       # Fill arrays
        str1 = '1 2 3 4 5'; arr1 = array(5)
loop    i = i + 1; str1 len(p) span('0123456789') . arr1<i> @p :s(loop)
        str2 = '6 7 8 9 10'; arr2 = array(5)
loop2   j = j + 1; str2 len(q) span('0123456789') . arr2<j> @q :s(loop2)
 
*       # Test and display
        arr3 = cat(arr1,arr2)
loop3   k = k + 1; str3 = str3 arr3<k> ' ' :s(loop3)
        output = str1
        output = str2
        output = str3
end