QUICK!

QUICK!

APPEND AND PRINT THE ARRAYS {1, 2, 3, 4} AND {5, 6, 7, 8}

OR THIS BIRD WILL STAB YOU!!!

#include
#include
#include

int main() {
const int first[4] = {1,2,3,4};
const int last[4] = {5,6,7,8};
int all[8];
memcpy(all, first, 4 * sizeof(int));
memcpy(all+4, last, 4 * sizeof(int));
printf("[");
for (int i = 0; i < 7; i++) printf("%d, ", all[i]);
printf("%d]\n", all[7]);
}

ar1, ar2 = [1,2,3,4], [5,6,7,8]
print(ar1 + ar2)

puts [1, 2, 3, 4] + [5, 6, 7, 8]

C BTFO

System.debug( JSON.serialize( new List{ List{1,2,3,4}, List{5,6,7,8}}));

Console.Log([1,2,3,4].concat([5,6,7,8]));

> perl -E "my @arr = (1, 2, 3, 4); my @arr2 = (5, 6, 7, 8); say @arr, @arr2"
12345678

print $ [1..4] ++ [5..8]

public class OpIsAFaggot {

public static void main(String[] args) {

int[] int1 = new int[]{1,2,3,4};
int[] int2 = new int[]{5,6,7,8};

int[] result = IntStream.concat(Arrays.stream(int1), Arrays.stream(int2)).toArray();

System.out.println(Arrays.toString(result));

}
}

>Console.Log

Precompute and hardcode the result

(displayln (append '(1 2 3 4) '(5 6 7 8)))

x = [1, 2, 3, 4]
y = [5, 6, 7, 8]
x.extend(y)
print(x)

var aOne = [1, 2, 3, 4], aTwo = [5, 6, 7, 8];
var aFinal = aOne.concat(aTwo);
for (var i = 0; i < aFinal.length; i++) {
console.log(aFinal[i]);
}

>ARRAYS
but those are tuples

{1, 2, 3, 4, 5, 6, 7, 8}

you're a tuple

This. Wtf are you fags doing?

int[] a3 = new int[a1.length + a2.length];
System.arraycopy(a1, 0, a3, 0, a1.length);
System.arraycopy(a2, 0, a3, a1.length, a2.length);
System.out.print(a3);

solving the problem, unlike

Abstraction is a crutch.

(format t "%s~%" (append '(1 2 3 4) '(5 6 7 8)))

(display (append '(1 2 3 4) '(5 6 7 8)))

...

public class Birdo{
public static void main(String[] args){
System.out.print("{");
for(int i = 1; i < 9; i++){
if(i == 8){
System.out.print(i);
break;
}
System.out.print(i+",");
}
System.out.print("}");
}
}

WolframLanguage
Print[Union[List[1, 2, 3, 4], List[5, 6, 7, 8]]];

[|5; 6; 7; 8|] |> Array.append [|1; 2; 3; 4|] |> printfn "%A"

remains to be beaten

#include

void main(){


int arr[4] = {1,2,3,4};
int arr2[4] = {5,6,7,8};
int arr3[8];

int i,j;

for(i=0;i

That's plain objects what you've wrote.
Object.assign({1, 2, 3, 4}, {5, 6, 7, 8});
Thanks god for javascript.

Hold on bird, its just compiling

KYS immediately

The point of those threads is to pick a wierd exotic language (which you would like to learn) and try it with that language.

p *(1..4), *(5..8)

> int main
> no return
Cuck

language?

Ruby

That seems incredibly straight forward.

Object.assign([1,2,3,4],[5,6,7,8],{log:function(){console.log(this)}}.log()

a = [1,2,3,4]
b = [5,6,7,8]
c = []
[c.append(i) for i in a], [c.append(j) for j in b]

BIRDMIN NO

>In case a return value is not defined by the programmer, an implicit return 0; at the end of the main() function is inserted by the compiler

(setf x (make-array '(4)
:initial-contents '((1) (2) (3) (4)))
)
(setf y (make-array '(4)
:initial-contents '((5) (6) (7) (8)))
)
(write x)
(write y)

lisp is autism.

+++[>++++++++++.+

echo "{1, 2, 3, 4, 5, 6, 7, 8}" | lpr

>quick do completely useless task only code monkeys will have to do
How about no?

app([], Rest, Rest).
app([H1|T1], List2, [H1|Rest]) :- app(T1, List2, Rest).

app([1, 2, 3, 4], [5, 6, 7, 8], X).

Without using the builtin append() predicate.

nobody wants you here.
oops forgot to print.
write(X).

>nobody wants you here
Yes. I come here to gloat.
This is all pointless crap. Nobody has to deal with strings in this manner anymore. Really if you're in a language that makes string handling convenient then why aren't you making it so you practically never have to deal with them at all? You clearly didn't care about the cost of running your application.

People being interested in stupid shit like this genuinely bothers me.

>Yes. I come here to gloat.
That much was obvious dude. Cause you're soooooooooooooo much better than everyone else here.

I'm primarily just suggesting you spend your time more productively.
This is like being amazed that multiplication is just repeated addition when you're 50.

cd array 1-8
ctrl-p
enter


wew that was close

>I'm primarily just suggesting you spend your time more productively.
says the fuckwit shitposting on a Sup Forums thread.

Posting 'solutions' in this thread suggests a lot about you professionally.
Posting on Sup Forums says very little.

linked lists are not arrays

>suggests a lot about you professionally.
>professionally.
dude wtf I'm on Sup Forums this isn't a job interview lmao.

print ([1..4] ++ [5..8] :: Vector Int)


happy now?

You're beyond autistic if you get triggered by people having fun with their profession/hobby.

x=(1 2 3 4)
y=(5 6 7 8)
z=($x $y)


Bonus points to anyone who can identify the language.

fn main() {
let mut x = vec![1, 2, 3, 4];
x.extend_from_slice(&[5, 6, 7, 8]);
println!("{:?}", x);
}

zsh

Fuck off with that shit, that's like saying the compiler will auto assign a variable the value of int if no value is stated.
Yes its valid code, but its terrible practise.

Maybe it's syntactically valid zsh, but not what I had in mind.

I think its fine.
Programs that don't care about the status return don't have to bother writing anything. People were still leaving it out in the implicit int days anyway, and it gives you no reason to use the pointlessly non-portable "void main".

console.log([1,2,3,4].concat([5,6,7,8]));

print (append '(1 2 3 4) '(5 6 7 8))

>but its terrible practise

sounds like you're being autistic. If you're not using return values for anything why bother.

because I spend all day writing C++ and JS mainly using shitty libraries and internal code that other people wrote, and sometimes I just wanna implement some shitty highschool level task.

Not everyone uses C90 user. in C++ and in C99 and newer, no implicit return statement.

#include

template
struct list
{
};

template
struct concat;

template
struct concat
{
using result = list;
};

template
void print(list)
{
(int[]){ (std::cout

Haskell:
[1..4]++[5..8]

abstraction makes it possible for someone to actually accomplish tasks without being a fucking wizard

I mean, manually fucking allocating and deallocating memory? Importing three libraries to add two sets and print the result? Low level is great for understanding and terrible for learning how to actually get shit done.

Finally someone

The struggle makes you stronger, like doing puzzles for your brain or lifting weights for your muscles. High-level languages are training wheels; they keep you weak and soft. The onus is not on the language to be more safe and user-friendly, but on the programmer to git gud.

C99. Works with arrays of arbitrary sizes.
#include
#define count(x) sizeof(x)/sizeof(int)

int main(void)
{
const int foo[] = {1, 2, 3, 4};
const int bar[] = {5, 6, 7, 8};
int baz[count(foo)+count(bar)];

for(int i = 0; i < count(baz); i++)
{
baz[i] = (i < count(foo))?foo[i]:bar[i-count(foo)];
printf("%d ", baz[i]);
}

return 0;
}

program BirdStab;

var
arr1: array[0..3] of integer = (1, 2, 3, 4);
arr2: array[0..3] of integer = (4, 5, 6, 7);
arr: array of integer;
i: integer;

begin
SetLength(arr, Length(arr1) + Length(arr2));
Move(arr1, arr[0], SizeOf(arr1));
Move(arr2, arr[Length(arr1)], SizeOf(arr2));

for i := 0 to Length(arr1) + Length(arr2) - 1 do
Write(arr[i], ' ');
WriteLn;
end.

program BirdStab;

var
arr1: array[0..3] of integer = (1, 2, 3, 4);
arr2: array[0..3] of integer = (4, 5, 6, 7);
arr: array of integer;
i: integer;

begin
SetLength(arr, Length(arr1) + Length(arr2));
Move(arr1, arr[0], SizeOf(arr1));
Move(arr2, arr[Length(arr1)], SizeOf(arr2));

for i := 0 to Length(arr1) + Length(arr2) - 1 do
Write(arr[i], ' ');
WriteLn;
end.

Nigga is this a fucking joke you posted it like 3 times you fagget if it's wrong it's wrong you leave it like that you piece of shit

my autism kicked in because SetLength and Move were capitalized but write and writeln were all lowercase

#include

main(){
int arr[4] = {1,2,3,4};
int ays[4] = {5,6,7,8};
int arrays[8];
int i;
for(i=0; i

$step = array("Post on Sup Forums", "Kill yourself", "???", "profit!");

$step_num = 0;

foreach ($step as &$step_name) {
$step_num++;
echo 'Step ' . $step_num . ': ', . $step_name;
}

["Post on Sup Forums", "Kill yourself", "???", "profit!"]
.each.with_index { |step,i| puts "Step #{i+1}: #{step}" }

let first = [1, 2, 3, 4];
let last = [5, 6, 7, 8];
[].push.apply(first, last);
console.log(first);

[1,2,3,4] ++ [5,6,7,8]


> Haskell FTW

Alt+prtscrn
Ctrl+P

You confused decimal 30 and hex 0x30, and you needed 31 (49) to start counting at one. And counting from 1 to 8 isn't appending two arrays.

[1,2,3,4] + [5,6,7,8]


>Ruby ftw

{1,2,3,4,5,6,7,8}

print([1,2,3,4]+[5,6,7,8])

horzcat([1 2 3 4],[5 6 7 8])

(print (append (list 1 2 3 4) (list 5 6 7 8)))

#import

int main(int argc, const char * argv[]) {
@autoreleasepool {
NSArray *first = @[@1,@2,@3,@4];
NSArray *second = @[@5,@6,@7,@8];

NSArray *all = [first arrayByAddingObjectsFromArray:second];

for(NSNumber *i in all){
NSLog(@"%@",i);
}
}
return 0;
}

puke.jpg

package main

import "fmt"

func main() {
arr1 := []int{1, 2, 3}
arr2 := []int{4, 5, 6}
fmt.Printf("%v\n", append(arr1, arr2...))
}

>assuming the num elements in the array will be 4 every time instead of making it general

#include
#include

int *printAndAppend(int *arr1, int *arr2, size_t, size_t);

int main(int argc, const char* argv[])
{
int arr1[] = {1,2,3,4};
int arr2[] = {5,6,7,8};
size_t size_arr1 = sizeof arr1 / sizeof *arr1;
size_t size_arr2 = sizeof arr2 / sizeof *arr2;

int* appended_arr = printAndAppend(arr1, arr2, size_arr1, size_arr2);
return 0;
}

int *printAndAppend(int *arr1, int *arr2, size_t size_arr1, size_t size_arr2)
{
size_t total_size = size_arr1 + size_arr2;
int *new_array = malloc(total_size * sizeof(int));
int i = 0;
int j = 0;

while (i < size_arr1 || j < size_arr2)
{
if (i < size_arr1)
{
int temp_val = *(new_array + i) = *(arr1 + i);
printf("%d\n", temp_val);

i++;
continue;
}

int temp_val = *(new_array + j) = *(arr2 + j);
printf("%d\n", temp_val);

j++;
}

return new_array;
}

I think the point was clearly laid out in the OP. If I don't want to get stabbed by a bird, why would I pick a language with which I'm unfamiliar?

Beatiful and totally straight forward. Classy language. Can you name it, lad?

using System;
using System.Collections.Generic;

namespace NoStabPls
{
public static class Program
{
static void Main()
{
int[] array1 = new int[] { 1, 2, 3, 4 };
int[] array2 = new int[] { 5, 6, 7, 8 };
List list = new List(array1);
list.AddRange(array2);
foreach (int n in list) Console.WriteLine(n.ToString());
}
}
}

function NoStab()
local donald = { 1, 2, 3, 4 }
local trump = { 5, 6, 7, 8 }
for i, v in pairs(trump) do
table.insert(donald, v)
end
for i, v in pairs(donald) do
print(v)
end
end