I have the following template:
template inPlace*(hs:int, code: untyped) =
block:
var i = len(Stack) - 1
var j: int
while i > -1:
j = 0
while j<Stack[i].len:
if Stack[i][j][0]==hs:
code
return
inc(j)
dec(i)
which is supposed to be called like this:
inPlace:
Stack[i][j][1] = ....
Is there any way Stack[i][j] is visible in the code segment passed to the template?
I can think of two ways off the top of my head:
Simple but ugly, just inject i and j:
https://play.nim-lang.org/#ix=230K
slightly more complicated but more beautiful (requires macros):