Example #1
0
 public static PlanItem[] MakePlan(PlanItem[] plan, Term t)
 {
     if (t is Name) return plan.Concat(Term(t)).ToArray();
     var app = (App)t;
     if (plan.Length == 0)
     {
         if (app.left is App)
         {
             return MakePlan(MakePlan(plan, app.left), app.right);
         }
         else
         {
             var name = (Name)app.left;
             return MakePlan(plan, app.right).Concat(new[] { new PlanItem { Card = name.name, ToLeft = true } }).ToArray();
         }
     }
     return
         MakePlan(
             MakePlan(
                 plan.Concat(SK()).ToArray(),
                 app.left)
                 .Concat(SK())
                 .Concat(Term("I")).ToArray(),
                 app.right);
 }
Example #2
0
 private static string FormatPlan(int slotNo, PlanItem[] plan)
 {
     var s = "";
     foreach (var i in plan)
     {
         s += (i.ToLeft ? (i.Card + " " + slotNo) : (slotNo + " " + i.Card)) + "\r\n";
     }
     return s;
 }