* Clause creation and destruction (`asserta/1`, `assertz/1`,
`retract/1`, `abolish/1`) with logical update semantics.
* Streams and predicates for stream control.
+* An incremental compacting garbage collector satisfying the five
+ properties of "Precise Garbage Collection in Prolog."
* Mode declarations.
* Extensions for clp(FD).
3. Add support for shift/reset delimited continuations, see "Delimited
Continuations for Prolog."
-4. Add an incremental compacting garbage collector for the heap.
-
-5. Add concurrent tables to manage shared references to atoms and
+4. Add concurrent tables to manage shared references to atoms and
strings.
-6. Add optional SLG resolution for fast memoization of predicates.
+5. Add optional SLG resolution for fast memoization of predicates.
-7. Add some form of JIT predicate indexing.
+6. Add some form of JIT predicate indexing.
## Installing rusty-wam
* `expand_term/2`
* `false/0`
* `float/1`
+* `freeze/2`
* `functor/3`
* `goal_expansion/2`
* `ground/1`
% 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)
).
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));
},
_ => {}
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;
// cut trailing ", "
let output_len = output.len();
output.truncate(output_len - 2);
-
+
println!("\r\n{}\r", output.result());
}
}
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) {
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 {