Пример #1
0
        protected override Expression VisitUnknown(Expression E)
        {
            Expression LE = Call.L(E, t, s);

            // Try applying a rule to E.
            Expression TLE = rules.Transform(LE);

            if (!ReferenceEquals(TLE, LE))
            {
                return(TLE);
            }

            // Try expanding E.
            Expression Ex = E.Expand(s);

            if (!Equals(E, Ex))
            {
                return(Visit(Ex));
            }

            // Try -L(-E, s, t)
            // TODO: It would be nice to handle this case in LinearTransform somehow.
            Expression NE  = Unary.Negate(E);
            Expression NEx = NE.Evaluate();

            if (!Equals(NE, NEx))
            {
                return(Unary.Negate(Visit(NEx)));
            }

            // Give up.
            return(LE);
        }
Пример #2
0
 public ISymbol Reduce(ISymbol expression)
 {
     return(_algebraReduce.Transform(expression));
 }