srecord noeq BStackComputeAllWithPrintStruct(VStack.Computable f) {
settable int maxBacktracks = 10;
settable int maxStepsPerBacktrack = 10;
gettable new L results;
settable IBStack stack;
*(IBStack *stack, VStack.Computable *f) {}
L get() {
// Make a stack with our computation
if (stack == null)
stack = new BStack(f);
else
stack.push(f);
repeat maxBacktracks {
// Get first or next result of function
A result = stack.nextResultWithPrintStruct(maxStepsPerBacktrack);
results.add(result);
print("Result: " + result);
// Ask the stack to backtrack to get another result
stack = stack.backtrack();
// If there is no more result, print message and exit
if (stack == null) {
print("No further result");
break;
}
// There is another result, so continue loop
}
ret results;
}
}