close #4524
This commit is contained in:
parent
ba61e7e3ac
commit
92ee2ee4ce
2 changed files with 23 additions and 1 deletions
|
|
@ -7,6 +7,8 @@ output: '''
|
|||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
|
||||
[1, 2, 3, 4]
|
||||
'''
|
||||
"""
|
||||
|
||||
|
|
@ -40,3 +42,13 @@ echo repr(m)
|
|||
echo repr(n)
|
||||
echo repr(o)
|
||||
|
||||
type
|
||||
Vect[N: static[int], A] = array[N, A]
|
||||
|
||||
proc push[N: static[int], A](a: Vect[N, A], x: A): Vect[N + 1, A] =
|
||||
for n in 0 .. < N:
|
||||
result[n] = a[n]
|
||||
result[N] = x
|
||||
|
||||
echo repr(push([1, 2, 3], 4))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue