|
|
|
|
|
by RaecKK
4188 days ago
|
|
Agreed. When the manual says you can pattern match with term rewriting macros, I think of Erlang pattern matching. Would something like this be possible? template mysum{a = @[]}(a: seq[int]): int = 0
template mysum{a}(a: seq[int]): int =
while a.low <= a.high:
a[a.low] + mysum(a[a.low + 1 .. a.high])
var x: seq[int] = @[1, 2, 3]
echo mysum(x)
|
|