Exemplo n.º 1
0
 public void extractFuncts(List functors, List functees, Exp orig) {
   for (int i = 0; i < exps.size(); i++) {
     Exp e = exps.get(i);
     e.extractFuncts(functors, functees, orig);
     List vars = e.freeVars();
     if (vars.size() == 1) {
       Var v = (Var) vars.get(0);
       Exp functee = new Funct(v, e.copy());
       Var v2 = new Var(functee.type());
       Appl a = new Appl(v2, v);
       exps.set(i, a);
       Exp functorbody = orig.copy();
       exps.set(i, e);
       Exp functor = new Funct(v2, functorbody);
       functors.add(functor);
       functees.add(functee);
     }
   }
 }