Last active
December 4, 2018 16:43
-
-
Save Vindaar/6d0e550e9b8944b30f6b030deda271fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
let key2 = [1, 2] &* 5 | |
echo key2 | |
let key3 = [1.5] &* 10 | |
echo key3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment