protected double Evaluate(FactorialUnaryOperatorASTNode node) { int fact(int x) => x == 1 ? 1 : x *fact(x - 1); var value = ( int )Evaluate(node.Target as dynamic); if (value < 0) { throw new System.Exception("Factorial only supports Positive Integers"); } return(fact(value)); }
protected double Evaluate(FactorialUnaryOperatorASTNode node) { int fact(int x) => x == 1 ? 1 : x *fact(x - 1); return(fact(( int )Evaluate(node.Target as dynamic))); }