task_url
stringlengths
30
116
task_name
stringlengths
2
86
task_description
stringlengths
0
14.4k
language_url
stringlengths
2
53
language_name
stringlengths
1
52
code
stringlengths
0
61.9k
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#HicEst
HicEst
REAL :: a(7), b(3), c(10)   c = a DO i = 1, LEN(b) c(i + LEN(a)) = b(i) ENDDO
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Hy
Hy
=> (setv a [1 2 3]) => a [1, 2, 3]   => (+ a [4 5 6]) ; returns the concatenation [1, 2, 3, 4, 5, 6] => a [1, 2, 3]   => (.extend a [7 8 9]) ; modifies the list in place => a [1, 2, 3, 7, 8, 9]   => (+ [1 2] [3 4] [5 6]) ; can accept multiple arguments [1, 2, 3, 4, 5, 6]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#i
i
main a $= [1, 2, 3] b $= [4, 5, 6]   print(a + b) }
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Icon_and_Unicon
Icon and Unicon
  procedure main() L1 := [1, 2, 3, 4] L2 := [11, 12, 13, 14] L3 := L1 ||| L2   sep := "" every writes(sep, !L3) do sep := ", " write() end  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#IDL
IDL
  > a = [1,2,3] > b = [4,5,6] > help,a A INT = Array[3] > help,b B INT = Array[3] > print,a 1 2 3 > print,b 4 5 6  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Idris
Idris
Idris> [1, 2] ++ [4, 5, 6] [1, 2, 3, 4, 5] : List Integer Idris> :module Data.Vect *Data/Vect> (the (Vect 2 Nat) [1, 2]) ++ (the (Vect 3 Nat) [3, 4, 5]) [1, 2, 3, 4, 5] : Vect 5 Nat
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Inform_7
Inform 7
let A be {1, 2, 3}; let B be {4, 5, 6}; add B to A;
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Ioke
Ioke
iik> [1,2,3] + [3,2,1] [1,2,3] + [3,2,1] +> [1, 2, 3, 3, 2, 1]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#J
J
array1 =: 1 2 3 array2 =: 4 5 6 array1 , array2 1 2 3 4 5 6
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Java
Java
public static Object[] concat(Object[] arr1, Object[] arr2) { Object[] res = new Object[arr1.length + arr2.length];   System.arraycopy(arr1, 0, res, 0, arr1.length); System.arraycopy(arr2, 0, res, arr1.length, arr2.length);   return res; }
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#JavaScript
JavaScript
var a = [1,2,3], b = [4,5,6], c = a.concat(b); //=> [1,2,3,4,5,6]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#jq
jq
[1,2] + [3] + [null] # => [1,2,3,null]   [range(1;3), 3, null] # => [1,2,3,null]  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Julia
Julia
a = [1,2,3] b = [4,5,6] ab = [a;b] # 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]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#K
K
  a: 1 2 3 b: 4 5 6 a,b 1 2 3 4 5 6
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Klingphix
Klingphix
include ..\Utilitys.tlhy   ( 1.0 "Hello" 3 2 / 4 2.1 power ) ( 5 6 7 8 ) chain print   " " input
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Klong
Klong
  [1 2 3],[4 5 6]  :" join " [1 2 3 4 5 6]   [1 2],:\[[3 4] [5 6] [7 8]]  :" join each-left " [[1 2 3 4] [1 2 5 6] [1 2 7 8]]   [1 2],:/[[3 4] [5 6] [7 8]]  :" join each-right " [[3 4 1 2] [5 6 1 2] [7 8 1 2]]  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Kotlin
Kotlin
fun main(args: Array<String>) { val a: Array<Int> = arrayOf(1, 2, 3) // initialise a val b: Array<Int> = arrayOf(4, 5, 6) // initialise b val c: Array<Int> = (a.toList() + b.toList()).toTypedArray() println(c) }
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#LabVIEW
LabVIEW
  {def A {A.new 1 2 3 4 5 6}} -> [1,2,3,4,5,6] {def B {A.new 7 8 9}} -> [7,8,9] {A.concat {A} {B}} -> [1,2,3,4,5,6,7,8,9]  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Lambdatalk
Lambdatalk
  {def A {A.new 1 2 3 4 5 6}} -> [1,2,3,4,5,6] {def B {A.new 7 8 9}} -> [7,8,9] {A.concat {A} {B}} -> [1,2,3,4,5,6,7,8,9]  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Lang5
Lang5
[1 2] [3 4] append collapse .
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#langur
langur
val .a = [1, 2, 3] val .b = [7, 8, 9] val .c = .a ~ .b writeln .c
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Lasso
Lasso
  local(arr1 = array(1, 2, 3)) local(arr2 = array(4, 5, 6)) local(arr3 = #arr1->asCopy) // make arr3 a copy of arr2 #arr3->merge(#arr2) // concatenate 2 arrays     Result:   arr1 = array(1, 2, 3) arr2 = array(4, 5, 6) arr3 = array(4, 5, 6) arr3 = array(1, 2, 3, 4, 5, 6)
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#LFE
LFE
  > (++ '(1 2 3) '(4 5 6)) (1 2 3 4 5 6) > (: lists append '(1 2 3) '(4 5 6)) (1 2 3 4 5 6)  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Liberty_BASIC
Liberty BASIC
x=10 y=20 dim array1(x) dim array2(y)   [concatenate] dim array3(x + y) for i = 1 to x array3(i) = array1(i) next for i = 1 to y array3(i + x) = array2(i) next   [print] for i = 1 to x + y print array3(i) next
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#LIL
LIL
## Array concatenation in LIL ## set a [list 1 2 3] set b [list 4 5 6] set c [quote $a $b]   print $c print "[index $c 0] [index $c 3]"
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Limbo
Limbo
implement Command;   include "sys.m"; sys: Sys;   include "draw.m";   include "sh.m";   init(nil: ref Draw->Context, nil: list of string) { sys = load Sys Sys->PATH;   a := array[] of {1, 2}; b := array[] of {3, 4, 5};   c := array[len a + len b] of int; c[:] = a; c[len a:] = b;   for (i := 0; i < len c; i++) ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Lingo
Lingo
a = [1,2] b = [3,4,5]   repeat with v in b a.append(v) end repeat   put a -- [1, 2, 3, 4, 5]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Little
Little
void main() { int a[] = {0, 1, 2, 3, 4}; int b[] = {5, 6, 7, 8, 9}; int c[] = {(expand)a, (expand)b}; puts(c); }
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Logo
Logo
  to combine-arrays :a1 :a2 output listtoarray sentence arraytolist :a1 arraytolist :a2 end show combine-arrays {1 2 3} {4 5 6}  ; {1 2 3 4 5 6}  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Lua
Lua
a = {1, 2, 3} b = {4, 5, 6}   for _, v in pairs(b) do table.insert(a, v) end   print(table.concat(a, ", "))
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#M2000_Interpreter
M2000 Interpreter
  a=(1,2,3,4,5) b=Cons(a, (6,7,8),a) Print b 1 2 3 4 5 6 7 8 1 2 3 4 5  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Maple
Maple
  > A := Array( [ 1, 2, 3 ] ); A := [1, 2, 3]   > B := Vector['row']( [ sin( x ), cos( x ), tan( x ) ] ); B := [sin(x), cos(x), tan(x)]   > ArrayTools:-Concatenate( 1, A, B ); # stack vertically [ 1 2 3 ] [ ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Mathcad
Mathcad
  create a pair of arbitrary array: a:=matrix(2,2,max) b:=a+3   a=|0 1| b=|3 4| |1 1| |4 4|   concatentate them vertically: |0 1| stack(a,b) = |1 1| |3 4| |4 4|   augment(a,b) = |0 1 3 4| |1 1 3 4|    
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
Join[{1,2,3}, {4,5,6}]   -> {1, 2, 3, 4, 5, 6}
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#MATLAB_.2F_Octave
MATLAB / Octave
>> a = [1 2 3]; >> b = [4 5 6]; >> c = [a b] c = 1 2 3 4 5 6 >> c = [a;b] c = 1 2 3 4 5 6
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Maxima
Maxima
u: [1, 2, 3, 4]$ v: [5, 6, 7, 8, 9, 10]$ append(u, v); /* [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] */   /* There are also functions for matrices */   a: matrix([6, 1, 8], [7, 5, 3], [2, 9, 4])$   addcol(a, ident(3)); /* matrix([6, 1, 8, 1, 0, 0], [7, 5, 3, 0, 1, 0], [2, 9, 4, 0, 0, 1]) */...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Mercury
Mercury
A `append` B = C
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#min
min
(1 2 3) (4 "apple" 6) concat print
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#MiniScript
MiniScript
  arrOne = [1, 2, 3] arrTwo = [4, 5, 6] print arrOne + arrTwo  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Nanoquery
Nanoquery
a + b
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Neko
Neko
/* Array concatenation, in Neko */   var a1 = $array(1,2,3,4) var a2 = $array("abc", "def")   /* $array(a1, a2) creates an array of two arrays, $aconcat merges to one */ var ac = $aconcat($array(a1, a2)) $print(ac, "\n")
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Nemerle
Nemerle
using System.Console; using Nemerle.Collections;   module ArrayCat { Main() : void { def arr1 = array[1, 2, 3]; def arr2 = array[4, 5, 6]; def arr12 = arr1.Append(arr2); // <---- foreach (i in arr12) Write($"$i "); } }
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#NetRexx
NetRexx
/* NetRexx */ options replace format comments java crossref nobinary   cymru = [ 'Ogof Ffynnon Ddu', 'Ogof Draenen' ]   dlm = '-'.copies(40)   say dlm loop c_ = 0 to cymru.length - 1 say c_ cymru[c_] end c_   yorks = [ 'Malham Tarn Pot', 'Greygill Hole' ]   say dlm loop y_ = 0 to yorks.length - 1 say y_ yorks[y_...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#NewLISP
NewLISP
; file: arraycon.lsp ; url: http://rosettacode.org/wiki/Array_concatenation ; author: oofoe 2012-01-28   (println "Append lists: " (append '(3 a 5 3) (sequence 1 9)))   (println "Multi append: " (append '(this is) '(a test) '(of the emergency) (sequenc...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Nial
Nial
a:= 1 2 3 +-+-+-+ |1|2|3| +-+-+-+ b:= 4 5 6 +-+-+-+ |4|5|6| +-+-+-+
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Nim
Nim
var x = @[1,2,3,4,5,6] y = @[7,8,9,10,11] z = x & y
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Oberon-2
Oberon-2
  MODULE ArrayConcat; IMPORT Out; TYPE IntArray = POINTER TO ARRAY OF INTEGER; VAR x, y, z: IntArray;   PROCEDURE InitArray(VAR x: IntArray;from: INTEGER); VAR i: LONGINT; BEGIN FOR i := 0 TO LEN(x^) - 1 DO x[i] := from; INC(from) END END InitArray;   PROCEDURE Concat(x,y: IntArr...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Objeck
Objeck
  bundle Default { class Arithmetic { function : Main(args : String[]) ~ Nil { array1 := [3, 5, 7]; array2 := [2, 4, 6];   array3 := Copy(array1, array2); each(i : array3) { array3[i]->PrintLine(); }; }   function : native : Copy(array1 : Int[], array2 : Int[]) ~ I...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Objective-C
Objective-C
NSArray *arr1 = @[@1, @2, @3]; NSArray *arr2 = @[@4, @5, @6]; NSArray *arr3 = [arr1 arrayByAddingObjectsFromArray:arr2];
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#OCaml
OCaml
# let list1 = [1; 2; 3];; val list1 : int list = [1; 2; 3] # let list2 = [4; 5; 6];; val list2 : int list = [4; 5; 6] # let list1and2 = list1 @ list2;; val list1and2 : int list = [1; 2; 3; 4; 5; 6]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Oforth
Oforth
import: mapping   [1, 2, 3 ] [ 4, 5, 6, 7 ] +
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Onyx
Onyx
# With two arrays on the stack, cat pops # them, concatenates them, and pushes the result back # on the stack. This works with arrays of integers, # strings, or whatever. For example,   [1 2 3] [4 5 6] cat # result: [1 2 3 4 5 6] [`abc' `def'] [`ghi' `jkl'] cat # result: [`abc' `def' `ghi' `jkl']   # To concatenate mor...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#ooRexx
ooRexx
a = .array~of(1,2,3) say "Array a has " a~items "items" b = .array~of(4,5,6) say "Array b has " b~items "items" a~appendall(b) -- adds all items from b to a say "Array a now has " a~items "items"
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Order
Order
#include <order/interpreter.h>   ORDER_PP( 8tuple_append(8tuple(1, 2, 3), 8tuple(4, 5, 6), 8pair(7, 8)) ) // -> (1,2,3,4,5,6,7,8)   ORDER_PP( 8seq_append(8seq(1, 2, 3), 8seq(4, 5, 6), 8seq(7, 8)) ) // -> (1)(2)(3)(4)(5)(6)(7)(8)
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#OxygenBasic
OxygenBasic
  'CREATE DYNAMIC ARRAY SPACES USING STRINGS   string sa=nuls 5* sizeof float string sb=sa   'MAP ARRAY VARIABLES ONTO STRINGS   float a at *sa float b at *sb   'ASSIGN SOME VALUES   a<=10,20,30,40,50 b<=60,70,80,90,00   'ADD ARRAY B TO A BY STRING CONCATENATION   sa+=sb   'TEST   print a[7] 'result 70  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Oz
Oz
%% concatenating 2 lists {Append [a b] [c d]} = [a b c d]   %% concatenating 2 tuples {Tuple.append t(1 2 3) u(4 5 6)} = u(1 2 3 4 5 6)
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#PARI.2FGP
PARI/GP
concat(u,v)
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Pascal
Pascal
my @arr1 = (1, 2, 3); my @arr2 = (4, 5, 6); my @arr3 = (@arr1, @arr2);
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Perl
Perl
my @arr1 = (1, 2, 3); my @arr2 = (4, 5, 6); my @arr3 = (@arr1, @arr2);
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Phix
Phix
sequence s1 = {1,2,3}, s2 = {4,5,6} ? s1 & s2
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Phixmonti
Phixmonti
1.0 "Hello" 3 2 / 4 2.1 power 4 tolist 5 6 7 8 4 tolist chain print
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#PHP
PHP
$arr1 = array(1, 2, 3); $arr2 = array(4, 5, 6); $arr3 = array_merge($arr1, $arr2);
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Picat
Picat
go => L1 = {1,2,3,4,5}, % define an array with {} L2 = {6,7,8,9},    % The built-in array/list concatenation println(L1 ++ L2),    % Using the built-in append/3 works only on lists  % so the arrays must be converted to lists. append(L1.to_list,L2.to_list,L3), println(L3.to_array), nl.
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#PicoLisp
PicoLisp
: (setq A (1 2 3) B '(a b c)) -> (a b c) : (conc A B) # Concatenate lists in 'A' and 'B' -> (1 2 3 a b c) : A -> (1 2 3 a b c) # Side effect: List in 'A' is modified!
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Pike
Pike
int main() { array arr1 = ({1, 2, 3}); array arr2 = ({4, 5, 6}); array arr3 = arr1 + arr2; }
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#PL.2FI
PL/I
  declare x(12) fixed; declare b(5) fixed defined x; declare c(7) fixed defined x(1sub+5);  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Pony
Pony
  actor Main new create(env:Env)=> var a:Array[I32]=Array[I32](4) var b:Array[I32]=Array[I32](2) a.push(1) a.push(2) a.push(3) a.push(4) b.push(5) b.push(6) a.concat(b.values()) for i in a.values() do env.out.print(i.string(...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#PostScript
PostScript
  [1 2 3 4] [5 6 7 8] concat  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#PowerShell
PowerShell
$a = 1,2,3 $b = 4,5,6   $c = $a + $b Write-Host $c
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Processing
Processing
  int[] a = {1, 2, 3}, b = {4, 5, 6};   int[] c = concat(a, b);  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Prolog
Prolog
  ?- append([1,2,3],[4,5,6],R). R = [1, 2, 3, 4, 5, 6].  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#PureBasic
PureBasic
Procedure displayArray(Array a(1), msg.s) Protected i Print(msg + " [") For i = 0 To ArraySize(a()) Print(Str(a(i))) If i <> ArraySize(a()) Print(", ") EndIf Next PrintN("]") EndProcedure   Procedure randomElements(Array a(1), lo, hi) Protected i For i = 0 To ArraySize(a()) a(i) = ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Python
Python
arr1 = [1, 2, 3] arr2 = [4, 5, 6] arr3 = [7, 8, 9] arr4 = arr1 + arr2 assert arr4 == [1, 2, 3, 4, 5, 6] arr4.extend(arr3) assert arr4 == [1, 2, 3, 4, 5, 6, 7, 8, 9]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Q
Q
list1:1 2 3 list2:4 5 6 list1,list2
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#QBasic
QBasic
FUNCTION ConcatArrays(a(), b()) ta = UBOUND(a) tb = UBOUND(b)   nt = ta + tb   FOR i = ta + 1 TO nt a(i) = b(i - ta) NEXT i   ConcatArrays = nt END FUNCTION   dimen = 5 DIM a(dimen) DIM b(dimen)   FOR i = 1 TO dimen a(i) = i b(i) = i + dimen NEXT i   nt = ConcatArrays(a(), b())   FOR i = 1 TO nt PRINT a(i); ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#QB64
QB64
    Dim As Integer First, Second First = 5: Second = 8   Dim As Integer Array1(1 To First), Array2(1 To Second), ArrayResult(1 To First + Second)     Init Array1(), 2 Print "First array" ShowArr Array1() Sleep 2 Print "Second array" Init Array2(), 5 ShowArr Array2() Sleep 2 Print "Final array"   ConcatArray Array1(), A...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Quackery
Quackery
> quackery Welcome to Quackery. Enter "leave" to leave the shell. /O> ' [ [ 1 2 ] [ 3 4 ] [ 5 6 ] ] ... ' [ [ 7 8 ] [ 9 0 ] ] join echo ... [ [ 1 2 ] [ 3 4 ] [ 5 6 ] [ 7 8 ] [ 9 0 ] ] Stack empty. /O> leave ... Goodbye.
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#R
R
  a1 <- c(1, 2, 3) a2 <- c(3, 4, 5) a3 <- c(a1, a2)  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Racket
Racket
  (vector-append #(1 2 3 4) #(5 6 7) #(8 9 10))  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Raku
Raku
my @array1 = 1, 2, 3; my @array2 = 4, 5, 6;   # If you want to concatenate two array to form a third, # either use the slip operator "|", to flatten each array.   my @array3 = |@array1, |@array2; say @array3;   # or just flatten both arrays in one fell swoop   @array3 = flat @array1, @array2; say @array3;   # On the ot...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#RapidQ
RapidQ
  DEFINT A(1 to 4) = {1, 2, 3, 4} DEFINT B(1 to 4) = {10, 20, 30, 40}   'Append array B to array A Redim A(1 to 8) as integer MEMCPY(varptr(A(5)), varptr(B(1)), Sizeof(integer)*4)  
http://rosettacode.org/wiki/ASCII_art_diagram_converter
ASCII art diagram converter
Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string: http://www.ietf.org/rfc/rfc1035.txt +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RC...
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B or android 64 bits */ /* program asciiDiagram64.s */   /*******************************************/ /* Constantes file */ /*******************************************/ /* for this file see task include a file in language AArch64 assembly*/ .include ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#REBOL
REBOL
  a1: [1 2 3] a2: [4 5 6] a3: [7 8 9]   append a1 a2 ; -> [1 2 3 4 5 6]   append/only a1 a3 ; -> [1 2 3 4 5 6 [7 8 9]]  
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Red
Red
>> arr1: ["a" "b" "c"] >> arr2: ["d" "e" "f"] >> append arr1 arr2 == ["a" "b" "c" "d" "e" "f"] >> arr3: [1 2 3] >> insert arr1 arr3 >> arr1 == [1 2 3 "a" "b" "c" "d" "e" "f"] >> arr4: [22 33 44] == [22 33 44] >> append/only arr1 arr4 == [1 2 3 "a" "b" "c" "d" "e" "f" [22 33 44]]
http://rosettacode.org/wiki/ASCII_art_diagram_converter
ASCII art diagram converter
Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string: http://www.ietf.org/rfc/rfc1035.txt +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RC...
#ARM_Assembly
ARM Assembly
  /* ARM assembly Raspberry PI or android 32 bits */ /* program asciiDiagram.s */   /* REMARK 1 : this program use routines in a include file see task Include a file language arm assembly for the routine affichageMess conversion10 see at end of this program the instruction include */ /* for constantes ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#ReScript
ReScript
Js.Array2.concat(["a", "b"], ["c", "d", "e"]) == ["a", "b", "c", "d", "e"]
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Retro
Retro
{ #1 #2 #3 } { #4 #5 #6 } a:append
http://rosettacode.org/wiki/ASCII_art_diagram_converter
ASCII art diagram converter
Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string: http://www.ietf.org/rfc/rfc1035.txt +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RC...
#C
C
  #include <stdlib.h> #include <stdio.h> #include <string.h> enum { MAX_ROWS=14, MAX_NAMES=20, NAME_SZ=80 };   char *Lines[MAX_ROWS] = { " +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+", " | ID |", " +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+", " |QR...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#REXX
REXX
a.1 = 10 a.2 = 22.7 a.7 = -12
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Ring
Ring
  arr1 = [1, 2, 3] arr2 = [4, 5, 6] arr3 = [7, 8, 9] arr4 = arr1 + arr2 see arr4 see nl arr5 = arr4 + arr3 see arr5  
http://rosettacode.org/wiki/ASCII_art_diagram_converter
ASCII art diagram converter
Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string: http://www.ietf.org/rfc/rfc1035.txt +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RC...
#C.2B.2B
C++
#include <array> #include <bitset> #include <iostream>   using namespace std;   struct FieldDetails {string_view Name; int NumBits;};   // parses the ASCII diagram and returns the field name, bit sizes, and the // total byte size template <const char *T> consteval auto ParseDiagram() { // trim the ASCII diagram t...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#RLaB
RLaB
  >> x = [1, 2, 3] >> y = [4, 5, 6] // appending matrix 'y' on the right from matrix 'x' is possible if the two matrices have // the same number of rows: >> z1 = [x, y] matrix columns 1 thru 6 1 2 3 4 5 6 // stacking matrix 'y' below the matrix 'x' ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Ruby
Ruby
arr1 = [1, 2, 3] arr2 = [4, 5, 6] arr3 = [7, 8, 9] arr4 = arr1 + arr2 # => [1, 2, 3, 4, 5, 6] arr4.concat(arr3) # => [1, 2, 3, 4, 5, 6, 7, 8, 9]
http://rosettacode.org/wiki/ASCII_art_diagram_converter
ASCII art diagram converter
Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string: http://www.ietf.org/rfc/rfc1035.txt +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RC...
#D
D
string makeStructFromDiagram(in string rawDiagram) pure @safe { import std.conv: text; import std.format: format; import std.string: strip, splitLines, indexOf; import std.array: empty, popFront;   static void commitCurrent(ref uint anonCount, ref uint totalBits, ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Rust
Rust
fn main() { let a_vec = vec![1, 2, 3, 4, 5]; let b_vec = vec![6; 5];   let c_vec = concatenate_arrays(&a_vec, &b_vec);   println!("{:?} ~ {:?} => {:?}", a_vec, b_vec, c_vec); }   fn concatenate_arrays<T: Clone>(x: &[T], y: &[T]) -> Vec<T> { let mut concat = x.to_vec(); concat.extend_from_slice(y...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#S-lang
S-lang
variable a = [1, 2, 3]; variable b = [4, 5, 6], c;
http://rosettacode.org/wiki/ASCII_art_diagram_converter
ASCII art diagram converter
Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string: http://www.ietf.org/rfc/rfc1035.txt +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RC...
#Go
Go
package main   import ( "fmt" "log" "math/big" "strings" )   type result struct { name string size int start int end int }   func (r result) String() string { return fmt.Sprintf("%-7s  %2d  %3d  %3d", r.name, r.size, r.start, r.end) }   func validate(diagram string) []string ...
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#SASL
SASL
(1 2 3) ++ (4 5 6)
http://rosettacode.org/wiki/Array_concatenation
Array concatenation
Task Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it.
#Scala
Scala
val arr1 = Array( 1, 2, 3 ) val arr2 = Array( 4, 5, 6 ) val arr3 = Array( 7, 8, 9 )   arr1 ++ arr2 ++ arr3 //or: Array concat ( arr1, arr2, arr3 ) // res0: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
http://rosettacode.org/wiki/ASCII_art_diagram_converter
ASCII art diagram converter
Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string: http://www.ietf.org/rfc/rfc1035.txt +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RC...
#Haskell
Haskell
import Text.ParserCombinators.ReadP import Control.Monad (guard)   data Field a = Field { fieldName :: String , fieldSize :: Int , fieldValue :: Maybe a}   instance Show a => Show (Field a) where show (Field n s a) = case a of Nothing -> n ++ "\t" ++ show s Just x -> ...