I think that's not possible with Nim's templating system, because a template can only expand into a single NimNode, while this would require expanding into two sibling NimNodes.
Idk what you want to archieve, but how about something like this? const lut = static: var result: seq[int] template entry(x: int) = result.add(x) result.add(x shr 2) entry 42 entry 12 entry 6 result Run