printer: abbreviate lists with |

This commit is contained in:
Mark Thom
2019-04-26 09:48:12 -06:00
parent 3783070585
commit 7bda7c5bf3
3 changed files with 5 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "scryer-prolog"
version = "0.8.66"
version = "0.8.67"
authors = ["Mark Thom <markjordanthom@gmail.com>"]
repository = "https://github.com/mthom/scryer-prolog"
description = "A modern Prolog implementation written mostly in Rust."

View File

@@ -609,11 +609,9 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
self.cyclic_terms.insert(addr, reps - 1);
iter.next()
} else {
if !self.at_cdr(", ...") {
push_space_if_amb!(self, "...", {
self.append_str("...");
});
}
push_space_if_amb!(self, "...", {
self.append_str("...");
});
iter.stack().pop();
self.cyclic_terms.remove(&addr);

View File

@@ -1638,7 +1638,7 @@ fn test_queries_on_builtins()
assert_prolog_failure!(&mut wam, "Pairs = [a-a|Pairs], keysort(Pairs, _).");
assert_prolog_success!(&mut wam, "Pairs = [a-a|Pairs], catch(keysort(Pairs, _), error(E, _), true).",
[["E = type_error(list, [a-a, a-a, a-a, ...])", "Pairs = [a-a | Pairs]"]]);
[["E = type_error(list, [a-a, a-a, a-a | ...])", "Pairs = [a-a | Pairs]"]]);
assert_prolog_success!(&mut wam, "keysort([], L).",
[["L = []"]]);