public static Token Cnr(string operation, List <Token> arguments) { if (arguments.Count != 2) { return(Token.Error("Function expects exactly 2 arguments")); } if (arguments[0].Count < 1 || arguments[1].Count < 1 || arguments[0].Count != arguments[1].Count || arguments[0].FirstValue != (int)arguments[0].FirstValue || arguments[1].FirstValue != (int)arguments[1].FirstValue || arguments[0].FirstValue < 0 || arguments[1].FirstValue < 0 || arguments[0].FirstValue < arguments[1].FirstValue ) { return(Token.Error("Argument(s) not valid")); } List <Token> factList = new List <Token>(); factList.Add(arguments[0]); factList.Add(arguments[1]); factList.Add(new Token(TokenType.Vector, arguments[0].FirstValue - arguments[1].FirstValue)); Token result = BasicCalculations.FindFactorial("fact", factList); return(new Token(TokenType.Vector, result[0] / (result[1] * result[2]))); }
static Function() { try { ArrayManipulator.CreateFunctions(); BasicCalculations.CreateFunctions(); LogsAndPowers.CreateFunctions(); Numerical.CreateFunctions(); Statistics.CreateFunctions(); Trigonometry.CreateFunctions(); Booleans.CreateFunctions(); Miscellaneous.CreateFunctions(); Matrix.CreateFunctions(); Testbed.CreateFunctions(); Directive.CreateFunctions(); Plot.CreateFunctions(); Text.CreateFunctions(); } catch //(TypeInitializationException) { //MessageBox.Show("Initialization error. Please restart the application \r\n" + e.Message); } }