This commit is contained in:
Zahary Karadjov
2017-06-10 18:01:10 +03:00
committed by Andreas Rumpf
parent f713e730c8
commit 9edf66df85

View File

@@ -16,6 +16,11 @@ output: '''
2x3 VectorVector [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
2x3 VectorArray [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
@[1, 2]
@[1, 2]
@[1, 2]@[3, 4]
@[1, 2]@[3, 4]
'''
"""
@@ -79,3 +84,28 @@ proc arrayTest =
arrayTest()
# https://github.com/nim-lang/Nim/issues/5756
type
Vec*[N : static[int]] = object
arr*: array[N, int32]
Mat*[M,N: static[int]] = object
arr*: array[M, Vec[N]]
proc vec2*(x,y:int32) : Vec[2] =
result.arr = [x,y]
proc mat2*(a,b: Vec[2]): Mat[2,2] =
result.arr = [a,b]
const a = vec2(1,2)
echo @(a.arr)
let x = a
echo @(x.arr)
const b = mat2(vec2(1, 2), vec2(3, 4))
echo @(b.arr[0].arr), @(b.arr[1].arr)
let y = b
echo @(y.arr[0].arr), @(y.arr[1].arr)