]> Repositorios git - scryer-prolog.git/commitdiff
update README, heap ADT
authorMark Thom <[email protected]>
Sun, 10 Dec 2017 20:55:49 +0000 (13:55 -0700)
committerMark Thom <[email protected]>
Sun, 10 Dec 2017 20:55:49 +0000 (13:55 -0700)
README.md
src/prolog/ast.rs

index 1e0ff29ed274d594c9a51b337ac5dd9918429cbc..ad634f739dd58f993b1472dfadf85515a7e5992c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,6 +42,23 @@ IR to get JIT-compiled and -executed Prolog programs.
 It's my hope to use rusty-wam as the logic engine of a low level (and
 ideally, very fast) [Shen](http://shenlanguage.org) implementation.
 
+## Nice to have features
+
+There are no current plans to implement any of these, but they might be
+nice to have in the future. They'd make a good project for anyone wanting
+to contribute code to rusty-wam.
+
+1. Add the global analysis techniques of Peter van Roy's thesis, "Can
+Logic Programming Execute as Fast as Imperative Programming?"
+
+2. Add support for unum representation and arithmetic, as described in Gustafson's
+book "The End of Error."
+
+3. Add support for shift/reset delimited continuations, see "Delimited Continuations
+for Prolog."
+
+4. Add an incremental compacting garbage collector the heap.
+
 ## Built-in predicates
 
 The following predicates are built-in to rusty-wam.
index a8c9f3766c34b3b726cdfaee163f2f20379542e5..bb24187e678e452fac3b0e1b883eb655ddbff631 100644 (file)
@@ -968,19 +968,13 @@ impl Heap {
     }
     
     pub fn push(&mut self, val: HeapCellValue) {
-        let h = self.h;
-        
-        if h < self.heap.len() {
-            self.heap[h] = val;
-        } else {
-            self.heap.push(val);
-        }
-
+        self.heap.push(val);
         self.h += 1;
     }
 
     pub fn truncate(&mut self, h: usize) {
         self.h = h;
+        self.heap.truncate(h);
     }
 
     pub fn len(&self) -> usize {
@@ -988,9 +982,10 @@ impl Heap {
     }
 
     pub fn append(&mut self, vals: Vec<HeapCellValue>) {
-        for val in vals.into_iter() {
-            self.push(val);
-        }
+        let n = vals.len();
+        
+        self.heap.extend(vals.into_iter());
+        self.h += n;
     }
 
     pub fn clear(&mut self) {