I want to execute the code below at compile time to initialize the global
variables shown - modpg, rescnt, residues, ep.
proc genPGparameters(prime: int): tuple =
echo("generating parameters for P", prime)
let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]
var modpg = 1
var excluded_primes = 0
for prm in primes:
excluded_primes += 1; modpg *= prm; if prm == prime: break
var pc = 3; var residues = @[1]
while pc < modpg:
if gcd(modpg, pc) == 1: residues.add(pc)
pc += 2
residues.add(modpg + 1)
let rescnt = residues.len-1
result = (modpg, rescnt, residues, excluded_primes)
const (modpg, rescnt, residues, ep) = genPGparameters(11)
I get this following error message pointer about the last line.
ssozp11x1c3parnew.nim(58, 7) Error: identifier expected, but found '(
I can't find the docs for this case, but I guess it's something simple. How do
I get the code to work?