Skip to content

Instantly share code, notes, and snippets.

@Varriount
Created May 23, 2017 19:10
Show Gist options
  • Save Varriount/7df2090adc52e9832647a3fb7b00e399 to your computer and use it in GitHub Desktop.
Save Varriount/7df2090adc52e9832647a3fb7b00e399 to your computer and use it in GitHub Desktop.
proc `&`[N1,N2, T1](arg1: array[N1,T1], arg2: array[N2,T1]): auto =
const length = (high(arg1) - low(arg1)) + (high(arg2) - low(arg2)) + 2
var res: array[length, T1]
var i = 0
for x in arg1:
res[i] = x
i += 1
for x in arg2:
res[i] = x
i += 1
return res
var
arr1 = [1,2,3,4]
arr2 = [5,6,7,8]
var arr3 = arr1 & arr2
echo repr(arr3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment