Use functions
Avoid writing programs with heavy computation at the top-level of a
file (ie. not inside a function). The compiler performs little or no
optimization on statements at the top-level at present. For example:
#include "axllib"
import from SingleInteger;
for i in 1..10 repeat {
for j in i..10 repeat {
-- some calculation ...
}
}
can be rewritten by enclosing it in a function and be optimised:
#include "axllib"
main():() == {
import from SingleInteger;
for i in 1..10 repeat {
for j in i..10 repeat {
-- some calculation ...
}
}
}
main();