;(G1, G2) :- '$get_b_value'(B), ;(G1, G2, B).
+:- non_counted_backtracking semicolon_compound_selector/3.
+semicolon_compound_selector(->(G2, G3), G4, B) :-
+ ( call(G2) ->
+ call(G3)
+ ; '$set_cp'(B),
+ call(G4)
+ ).
+semicolon_compound_selector(','(G2, G3), G4, B) :-
+ ( ','(G2, G3, B)
+ ; '$set_cp'(B),
+ call(G4)
+ ).
+semicolon_compound_selector(';'(G2, G3), G4, B) :-
+ ( ';'(G2, G3, B)
+ ; '$set_cp'(B),
+ call(G4)
+ ).
+
:- non_counted_backtracking (;)/3.
-;(G1, G4, B) :- compound(G1),
- '$call_with_default_policy'(G1 = ->(G2, G3)),
- !,
- ( call(G2) -> call(G3)
- ; '$set_cp'(B),
- call(G4)
- ).
-;(G1, G2, B) :- G1 == !, '$set_cp'(B), call(G2).
-;(G1, G2, B) :- G2 == !, call(G1), '$set_cp'(B).
-;(G, _, _) :- call(G).
-;(_, G, _) :- call(G).
+;(G1, G4, B) :-
+ compound(G1),
+ semicolon_compound_selector(G1, G4, B).
+;(G1, G2, B) :-
+ G1 == !, '$set_cp'(B), call(G2).
+;(G1, G2, B) :-
+ G2 == !, call(G1), '$set_cp'(B).
+;(G, _, _) :-
+ call(G).
+;(_, G, _) :-
+ call(G).
G1 -> G2 :- '$get_b_value'(B), '$call_with_default_policy'(->(G1, G2, B)).
; '$reset_block'(NBb),
'$fail').
scc_helper(_, _, Bb) :-
- '$reset_block'(Bb), '$get_ball'(Ball),
+ '$reset_block'(Bb),
+ '$get_ball'(Ball),
'$call_with_default_policy'(run_cleaners_with_handling),
'$erase_ball',
'$call_with_default_policy'(throw(Ball)).
.unwrap_or((Predicate::new(), VecDeque::from(vec![])))
}
- pub(crate) fn add_in_situ_result(
+ pub(crate)
+ fn add_in_situ_result(
&mut self,
result: &CompiledResult,
in_situ_code_dir: &mut InSituCodeDir,
}
#[inline]
- pub(super) fn size_of_cached_query(&self) -> usize {
+ pub(super)
+ fn size_of_cached_query(&self) -> usize {
self.cached_query.len()
}
#[inline]
- pub(super) fn take_in_situ_code(&mut self) -> Code {
+ pub(super)
+ fn take_in_situ_code(&mut self) -> Code {
mem::replace(&mut self.in_situ_code, Code::new())
}
- pub(super) fn lookup_instr<'a>(
+ pub(super)
+ fn lookup_instr<'a>(
&'a self,
last_call: bool,
p: &CodePtr,
}
}
}
- None => panic!("expected SCCCutPolicy trait object."),
+ None => {
+ }
};
self.fail = true;
let mut term = *term;
if let Term::Clause(cell, name, terms, op_spec) = term {
- if name.as_str() == "," {
+ if name.as_str() == "," && terms.len() == 2 {
let term = Term::Clause(cell, name, terms, op_spec);
let mut subterms = unfold_by_str(term, ",");
-:- module('$toplevel', [repl/1, consult/1, use_module/1, use_module/2]).
+:- module('$toplevel', ['$repl'/1, consult/1, use_module/1, use_module/2]).
:- use_module(library(charsio)).
:- use_module(library(lists)).
:- use_module(library(si)).
-repl([_|Args]) :-
+'$repl'([_|Args]) :-
maplist(use_list_of_modules, Args),
false.
-repl(_) :- repl.
+'$repl'(_) :- repl.
use_list_of_modules(Mod0) :-
atom_chars(Mod, Mod0),