summary refs log tree commit diff stats
path: root/tests/accept/compile/tseq2.nim
blob: 03bdb3fabd9845ccc7ae273302bfc2298daa762b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
  
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])