Anonymous user
Forward difference: Difference between revisions
Added parameter types to make the program able to compile with Nim 1.4. Changed code to avoid to use a slice which implies a copy.
(Add Plain English) |
(Added parameter types to make the program able to compile with Nim 1.4. Changed code to avoid to use a slice which implies a copy.) |
||
Line 1,982:
=={{header|Nim}}==
<lang nim>proc dif(s: seq[int]): seq[int] =
result = newSeq[int](s.len-1)
for i
result[i] =
proc difn(s
if n > 0: difn(dif(s), n-1)
else: s
const s = @[90, 47, 58, 29, 22, 32, 55, 5, 55, 73]
echo difn(s, 0)
|