This works:
import macros
import std/genasts
macro applyThem(x,y: tuple; op: untyped): untyped =
result = nnkTupleConstr.newNimNode
for i in 0 ..< x.getTypeImpl.len:
let ast = genAst(i, x, y, op):
block:
var
a{.inject.} = x[i]
b{.inject.} = y[i]
op
result.add ast
assert applyThem( (x: 3, y: 4), (u: 4,v: 5), a+b ) == (7,9)
assert applyThem( (1, 2.0), (3, 4.5), a*b) == (3, 9.0)
Run
