correct attribute_goals/2 bug, add freeze/2, update README
This commit is contained in:
@@ -36,8 +36,7 @@ verify_attributes(Var, Value, Goals) :-
|
||||
% suggestions for improvement.
|
||||
|
||||
dif(X, Y) :- X \== Y,
|
||||
( X \= Y -> true
|
||||
; term_variables(X, XVars), term_variables(Y, YVars),
|
||||
( term_variables(X, XVars), term_variables(Y, YVars),
|
||||
dif_set_variables(XVars, X, Y),
|
||||
dif_set_variables(YVars, X, Y)
|
||||
).
|
||||
|
||||
@@ -83,14 +83,14 @@ impl MachineState {
|
||||
self[temp_v!(2)] = value_list_addr;
|
||||
}
|
||||
|
||||
fn gather_attr_vars_created_since(&mut self, h: usize) -> IntoIter<Addr> {
|
||||
fn gather_attr_vars_created_since(&self, h: usize) -> IntoIter<Addr> {
|
||||
let mut attr_vars = HashSet::new();
|
||||
|
||||
for i in h .. self.heap.len() {
|
||||
for i in h .. self.heap.h {
|
||||
let addr = self.heap[i].as_addr(i);
|
||||
|
||||
match self.store(self.deref(addr)) {
|
||||
Addr::AttrVar(h) => {
|
||||
match addr {
|
||||
Addr::AttrVar(h) if i == h => {
|
||||
attr_vars.insert(Addr::AttrVar(h));
|
||||
},
|
||||
_ => {}
|
||||
@@ -162,13 +162,13 @@ impl MachineState {
|
||||
if attr_goals.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let mut output = PrinterOutputter::new();
|
||||
|
||||
for goal_addr in attr_goals {
|
||||
let mut printer = HCPrinter::from_heap_locs(&self, output, var_dict);
|
||||
printer.see_all_locs();
|
||||
|
||||
|
||||
printer.numbervars = false;
|
||||
printer.quoted = true;
|
||||
|
||||
@@ -179,7 +179,7 @@ impl MachineState {
|
||||
// cut trailing ", "
|
||||
let output_len = output.len();
|
||||
output.truncate(output_len - 2);
|
||||
|
||||
|
||||
println!("\r\n{}\r", output.result());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,6 +320,7 @@ static TERMS: &str = include_str!("../lib/terms.pl");
|
||||
static DCGS: &str = include_str!("../lib/dcgs.pl");
|
||||
static ATTS: &str = include_str!("../lib/atts.pl");
|
||||
static DIF: &str = include_str!("../lib/dif.pl");
|
||||
static FREEZE: &str = include_str!("../lib/freeze.pl");
|
||||
|
||||
impl Machine {
|
||||
fn compile_special_forms(&mut self) {
|
||||
@@ -349,6 +350,7 @@ impl Machine {
|
||||
compile_user_module(self, DCGS.as_bytes());
|
||||
compile_user_module(self, ATTS.as_bytes());
|
||||
compile_user_module(self, DIF.as_bytes());
|
||||
compile_user_module(self, FREEZE.as_bytes());
|
||||
}
|
||||
|
||||
pub fn new() -> Self {
|
||||
|
||||
Reference in New Issue
Block a user