}
}
-pub trait MutStackHCIterator
-where Self: Iterator<Item = Addr>
+pub trait MutStackHCIterator<'b> where Self: Iterator
{
- fn stack(&mut self) -> &mut Vec<Addr>;
+ type MutStack;
+
+ fn stack(&'b mut self) -> Self::MutStack;
}
pub struct HCPostOrderIterator<'a> {
}
}
-impl<'a> MutStackHCIterator for HCPreOrderIterator<'a> {
- fn stack(&mut self) -> &mut Vec<Addr> {
+impl<'b, 'a: 'b> MutStackHCIterator<'b> for HCPreOrderIterator<'a> {
+ type MutStack = &'b mut Vec<Addr>;
+
+ fn stack(&'b mut self) -> Self::MutStack {
&mut self.state_stack
}
}
pub first_to_expire: Ordering,
}
+impl<'b, 'a: 'b> MutStackHCIterator<'b> for HCZippedAcyclicIterator<'a> {
+ type MutStack = (&'b mut Vec<Addr>, &'b mut Vec<Addr>);
+
+ fn stack(&'b mut self) -> Self::MutStack {
+ (self.i1.stack(), self.i2.stack())
+ }
+}
+
impl<'a> HCZippedAcyclicIterator<'a> {
pub fn new(i1: HCPreOrderIterator<'a>, i2: HCPreOrderIterator<'a>) -> Self {
HCZippedAcyclicIterator {
if !self.seen.contains(&(a1.clone(), a2.clone())) {
self.i1.stack().push(a1.clone());
self.i2.stack().push(a2.clone());
+
self.seen.insert((a1, a2));
break;
iter.first_to_expire != Ordering::Equal
}
- pub(super) fn compare_term_test(&self, a1: &Addr, a2: &Addr) -> Option<Ordering> {
+ pub(super)
+ fn compare_term_test(&self, a1: &Addr, a2: &Addr) -> Option<Ordering> {
let mut iter = self.zipped_acyclic_pre_order_iter(*a1, *a2);
while let Some((v1, v2)) = iter.next() {
).
print_exception(E) :-
- ( E == error('$interrupt_thrown', repl) -> nl % print the exception on a newline to evade "^C".
+ ( E == error('$interrupt_thrown', repl) -> nl % print the
+ % exception on a
+ % newline to evade
+ % "^C".
; true
),
write_term('caught: ', [quoted(false), max_depth(20)]),