Usually, you would define `action` as `proc(l,r: T): T`. But this does not work
for `xor` because of this paragraph in the manual ([see
also](https://github.com/nim-lang/Nim/issues/2172)):
> Assigning/passing a procedure to a procedural variable is only allowed if one
> of the following conditi
I think you need to use a Template or an anonymous function to do what you want:
template testA[T](a: T, action: untyped, b: T): T = action(a,b)
echo testA(1, `xor`, 2)
proc testB[T](a: T, action: proc(a,b: T):T , b: T): T = action(a,b)
echo testB(1, proc(a, b: int):
I could not find any example but this is the sort of thing I want to get
working:
proc bitWise*[T](buff: openArray[T], action: expr, mask: openArray[T]):
seq[T] =
var c = items #or some custom iterator
result = buff.mapMe(it action c(mask)) # mapMe is an openArray fr