Skip to content

Instantly share code, notes, and snippets.

import macros, typetraits
macro `&*`[T; N: static[int]](a: array[N, T], x: static[int]): untyped =
result = nnkBracket.newTree()
for i in 0 ..< x:
for j in 0 ..< N:
result.add a[j]
let key = [0] &* 10
echo name(type(key))