Warning: session_start(): open(/var/lib/php/sessions/sess_sfge4i74o76v7hik1sm6pblved, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass BStack > VStack {
// alternative to backtrack to
IF0 alternative;
// steps to undo before switching to the alternative
L undos;
*() {}
*(Computable computation) { push(computation); }
*(Iterable l) { pushAll(l); }
BStack cloneStack() {
new BStack s;
s.stack = shallowCloneElements(stack);
ret s;
}
void addUndo(AutoCloseable undo) {
if (undo == null) ret;
if (undos == null) undos = new L;
undos.add(undo);
}
void options(A function,
VIF1 options) {
}
BStack addAlternative(IVF1 action) {
BStack clonedStack = cloneStack();
alternative = -> {
action.get(clonedStack);
ret clonedStack;
};
ret clonedStack;
}
BStack backtrack() ctex {
if (undos != null)
for (undo : reversed(getAndClearList(undos)))
undo.close();
ret alternative?!;
}
}