template helloRewrite{`*`(`*`(a, b), c)}(a, b, c: int): int =
echo "huuu"
41
echo((3 * 5) * 2)
echo(3 * 5 * 2)
Apparently, none of those two example matches. What am I doing wrong?
PS I know I can match nested binary expressions with the * operator, but I actually need a fixed number of parameters. My aim would be to rewrite operations such as this to a single BLAS function call.
This already gets calculated by Nim's VM at compile time. Check the resulting C code and you'll find:
STRING_LITERAL(TMP5, "30", 2);
printf("%s\012", ((NimStringDesc*) &TMP5)? (((NimStringDesc*) &TMP5))->data:"nil");
printf("%s\012", ((NimStringDesc*) &TMP5)? (((NimStringDesc*) &TMP5))->data:"nil");