private static IToken Acquire(IToken arg0, IToken arg1) { var key = Tuple.Create(arg0, arg1); if (Cache.TryGetValue(key, out var cached)) { return(cached); } IToken x; if (arg1 == null) { x = new LtOperator(arg0); } else { var x0 = AlienMessageParser.Reduce(arg0); var x1 = AlienMessageParser.Reduce(arg1); x = x0.AsValue() < x1.AsValue() ? (IToken)KComb.Acquire() : FComb.Acquire(); } Cache[key] = x; return(x); }
private static KComb Acquire(IToken arg1) { if (Cache.TryGetValue(arg1, out var cached)) { return(cached); } var x = new KComb(arg1); Cache[arg1] = x; return(x); }
public IToken Apply(IToken arg) { var x0 = AlienMessageParser.Reduce(arg); if (x0 is NilOperator) { return(KComb.Acquire()); } else if (x0 is ConsOperator) { return(FComb.Acquire()); } else { throw new InvalidOperationException(); } }