Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.14 KB | None | 0 0
  1.     override def unifyCB2(t:Term, ctx:CallContext):ComputationBounds[Boolean]=
  2.     {
  3.      if (ctx.checkStackOverflow) {
  4.        CallCC(ctx)(Call{ (ctx:CallContext) => unifyCB2(t,ctx) });
  5.      } else {
  6.        if (t.isFunctional) {
  7.          if (t.funName == name) {
  8.             return unifySeqCB2(funArgs,t.funArgs,ctx.withCall);
  9.          } else {
  10.             Done(false);
  11.          }
  12.        } else {
  13.           Done(false);
  14.        }
  15.      }
  16.   }
  17.  
  18.  
  19.  
  20. def unifySeqCB2(x:Seq[Term],y:Seq[Term],ctx:CallContext):
  21.                                              ComputationBounds[Boolean]=
  22.   {
  23.     if (x.isEmpty) {
  24.        Done(y.isEmpty)
  25.     } else {
  26.        if (ctx.checkStackOverflow) {
  27.          CallCC(ctx)(Call{ (ctx) => unifySeqCB2(x,y,ctx) });
  28.        } else {
  29.          x.head.onUnifyCB2(y.head,ctx.withCall) {
  30.           (r:Boolean, ctx:CallContext) =>
  31.              if (!r) {
  32.                Done(false)
  33.              } else {
  34.                if (x.isEmpty) {
  35.                   Done(y.isEmpty);
  36.                }else{
  37.                   unifySeqCB2(x.tail,y.tail,ctx.withCall)
  38.                }
  39.              }
  40.          }
  41.        }
  42.     }
  43.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement