PopGoalStack() public method

Mark that this is the start of a new clause Removes the top goal from the goal stack
public PopGoalStack ( ) : void
return void
示例#1
0
        IEnumerable <CutState> CallPrimitive(Symbol functor, PrologPrimitives.PrimitiveImplementation handler, object[] args, PrologContext context)
        {
            if (Trace)
            {
                context.TraceOutput("Goal: {0}", new Structure(functor, args));
            }
            foreach (var state in handler(args, context))
            {
                if (Trace)
                {
                    context.TraceOutput((state == CutState.Continue) ? "Succeed: {0}" : "Cut: {0}", new Structure(functor, args));
                }
                yield return(state);

                if (Trace)
                {
                    context.TraceOutput("Retry: {0}", new Structure(functor, args));
                }
            }
            if (Trace)
            {
                context.TraceOutput("Fail: {0}", new Structure(functor, args));
            }
            context.PopGoalStack();
        }
示例#2
0
 IEnumerable<CutState> CallPrimitive(Symbol functor, PrologPrimitives.PrimitiveImplementation handler, object[] args, PrologContext context)
 {
     if (Trace)
         context.TraceOutput("Goal: {0}", new Structure(functor, args));
     foreach (var state in handler(args, context))
     {
         if (Trace)
         context.TraceOutput((state == CutState.Continue) ? "Succeed: {0}" : "Cut: {0}", new Structure(functor, args));
         yield return state;
         if (Trace)
             context.TraceOutput("Retry: {0}", new Structure(functor, args));
     }
     if (Trace)
         context.TraceOutput("Fail: {0}", new Structure(functor, args));
     context.PopGoalStack();
 }