With recursion a top level algo might reference itself which, due to the naivety of the function sorting the algos before compilation, leads to a Unsortable! (Probably due to a cycle) error.
The function in question should be appropriately changed to account for recursive functions.
Workaround
The same issue does not apply to locally defined functions. By making the recursive function local, recursion can be used.
aka a source file with
fn go (n:i32) {
if (lt(n, 0)) { n } else { go(minus(n,3)) }
}
With recursion a top level algo might reference itself which, due to the naivety of the function sorting the algos before compilation, leads to a
Unsortable! (Probably due to a cycle)
error. The function in question should be appropriately changed to account for recursive functions.Workaround
The same issue does not apply to locally defined functions. By making the recursive function local, recursion can be used.
aka a source file with
can be written as
and will then be accepted by the compiler