tarrayplus.nim 306 B

1234567891011121314
  1. discard """
  2. errormsg: "type mismatch: got <array[0..2, float], array[0..1, float]>"
  3. """
  4. proc `+`*[R, T] (v1, v2: array[R, T]): array[R, T] =
  5. for i in low(v1)..high(v1):
  6. result[i] = v1[i] + v2[i]
  7. var
  8. v1: array[0..2, float] = [3.0, 1.2, 3.0]
  9. v2: array[0..1, float] = [2.0, 1.0]
  10. v3 = v1 + v2