Open
Description
I would like to be able to define global constants.
Something like:
const foo = 12345;
template Bar() {
signal input A;
signal output B;
B <== A + foo;
}
Also for other data types (which right now are only lists, and lists of lists etc, I guess?)
const myList = [1,2,3,4,5];
template Baz()
signal input A[5];
signal output B;
var sum = 0;
for(var i=0; i<5; i++) { sum += myList[i] * A[i]; }
out <== sum;
}
This is a very simple feature which imho would have a significant quality-of-life effect.
Note that you can already emulate this by using functions:
function foo() { return 12345; }
template Bar() {
signal input A;
signal output B;
B <== A + foo();
}
but that's a bit verbose.