summary refs log blame commit diff stats
path: root/tests/seq/tseq2.nim
blob: 5de9402ecbe759ae0a4de338f9b88c08c425228d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                      




                                               
                  



                                               
proc `*` *(a, b: seq[int]): seq[int] =
  # allocate a new sequence:
  newSeq(result, len(a))
  # multiply two int sequences:
  for i in 0..len(a)-1: result[i] = a[i] * b[i]

when isMainModule:
  # test the new ``*`` operator for sequences:
  assert(@[1, 2, 3] * @[1, 2, 3] == @[1, 4, 9])