fn unfold(&mut self) -> Option<Spine> {

    let mut g = self.spines[self.spines_top - 1].clone();
    let ttop = self.trail.len() as Int - 1;
    let htop = self.top;
    let base = htop + 1;

    self.make_index_args(&mut g);

    let last = g.cs.len() as Int;
    for k in g.k .. last {
      let c0 = self.clauses[g.cs[k as usize] as usize].clone();
      if !g.match_i(&c0) {
        continue
      }

      let base0 = base - c0.base;
      let b = tag(V, base0);
      let head = self.push_head(b, &c0);
      self.ustack.clear();
      self.ustack.push(head);
      self.ustack.push(g.gs[0]);
      if !self.unify(base) {
        self.unwind_trail(ttop);
        self.top = htop;
        continue;
      }

      self.push_body(b, head, &c0);
      g.k = k + 1;
      self.spines[self.spines_top - 1].k = g.k;

      if self.gs_push_body.len() > 1 || g.gs.len() > 1 {
        let p = self.gs_push_body.clone();
        let s = self.new_spine(&p, base, Some(&g.gs), ttop);
        return Some(s);
      } else {
        return Some(self.answer(ttop));
      }
    }
    None
  }
/**
  * transforms a spine containing references to choice point and
  * immutable list of goals into a new spine, by reducing the
  * first goal in the list with a clause that successfully
  * unifies with it - in which case places the goals of the
  * clause at the top of the new list of goals, in reverse order
  */
transforms a spine containing references to choice point and
immutable list of goals into a new spine, by reducing the
first goal in the list with a clause that successfully
unifies with it - in which case places the goals of the
clause at the top of the new list of goals, in reverse order
transforms a spine containing references to choice point and immutable list of goals into a new spine by reducing the first goal in the list with a clause that successfully unifies with it - in which case places the goals of the clause at the top of the new list of goals in reverse order
fn unfold(&mut self) -> Option<Spine> {
    let mut g = self.spines[self.spines_top - 1].clone();
    let ttop = self.trail.len() as Int - 1;
    let htop = self.top;
    let base = htop + 1;
    self.make_index_args(&mut g);
    let last = g.cs.len() as Int;
    for k in g.k .. last {
      let c0 = self.clauses[g.cs[k as usize] as usize].clone();
      if !g.match_i(&c0) {
        continue
      }
      let base0 = base - c0.base;
      let b = tag(V, base0);
      let head = self.push_head(b, &c0);
      self.ustack.clear();
      self.ustack.push(head);
      self.ustack.push(g.gs[0]);
      if !self.unify(base) {
        self.unwind_trail(ttop);
        self.top = htop;
        continue;
      }
      self.push_body(b, head, &c0);
      g.k = k + 1;
      self.spines[self.spines_top - 1].k = g.k;
      if self.gs_push_body.len() > 1 || g.gs.len() > 1 {
        let p = self.gs_push_body.clone();
        let s = self.new_spine(&p, base, Some(&g.gs), ttop);
        return Some(s);
      } else {
        return Some(self.answer(ttop));
      }
    }
    None
  }
fn unfold ( & mut self ) -> Option < Spine > { let mut g = self . spines [ self . spines_top - 1 ] . clone ( ) ; let ttop = self . trail . len ( ) as Int - 1 ; let htop = self . top ; let base = htop + 1 ; self . make_index_args ( & mut g ) ; let last = g . cs . len ( ) as Int ; for k in g . k .. last { let c0 = self . clauses [ g . cs [ k as usize ] as usize ] . clone ( ) ; if ! g . match_i ( & c0 ) { continue } let base0 = base - c0 . base ; let b = tag ( V , base0 ) ; let head = self . push_head ( b , & c0 ) ; self . ustack . clear ( ) ; self . ustack . push ( head ) ; self . ustack . push ( g . gs [ 0 ] ) ; if ! self . unify ( base ) { self . unwind_trail ( ttop ) ; self . top = htop ; continue ; } self . push_body ( b , head , & c0 ) ; g . k = k + 1 ; self . spines [ self . spines_top - 1 ] . k = g . k ; if self . gs_push_body . len ( ) > 1 || g . gs . len ( ) > 1 { let p = self . gs_push_body . clone ( ) ; let s = self . new_spine ( & p , base , Some ( & g . gs ) , ttop ) ; return Some ( s ) ; } else { return Some ( self . answer ( ttop ) ) ; } } None }
transforms a spine containing references to choice point and
 immutable list of goals into a new spine, by reducing the
 first goal in the list with a clause that successfully
 unifies with it - in which case places the goals of the
 clause at the top of the new list of goals, in reverse order
transforms a spine containing references to choice point and immutable list of goals into a new spine by reducing the first goal in the list with a clause that successfully unifies with it - in which case places the goals of the clause at the top of the new list of goals in reverse order
&mut self
&mut self