/* ** Noun forms of the arithmatic functions ** */ /* This file attempts to define arithmetic functions which do not perform their actual mathematical functions. That is to say noun forms of the standard arithmetic functions. This is to give much finer control over the simplification of very elementary expressions. Chris Sangwin 25 Oct 2005. */ /* Create noun forms of the functions of +, -, *, / and ^ as follows. + n+ - n- * n* / n/ ^ n^ */ /* (1) */ nary("n+",100); prefix("n-",100); nary("n*",120); infix("n/",122,123); infix("n^",140,139); /* (2) */ load("noun_arith.lisp"); /* (3) */ verb_arith(ex) := block( ex:subst("+","N+",ex), ex:subst("*","N*",ex), ex:subst("-","N-",ex), ex:subst("//","N/",ex), ex:subst("^","N^",ex), ev(ex)); /* (4) */ noun_arith(ex) := block( ex:subst("N+","+",ex), ex:subst("N*","*",ex), ex:subst("N-","-",ex), ex:subst("N/","//",ex), ex:subst("N^","^",ex), ev(ex)); /* (4) */ gather_reduce(ex) := block( ex:subst("+","N+",ex), ex:subst("*","N*",ex), ex:subst("-","N-",ex), ex:ev(ex), ex:subst("N+","+",ex), ex:subst("N*","*",ex), ex:subst("N-","-",ex), ex);