diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-09-11 19:28:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-09-11 19:28:52 -0700 |
commit | 46f607ae233a8f71c09d40dd45aae5f2ec7056fc (patch) | |
tree | 6c667191e2a3e92eab802854382fd778db6bfa73 | |
parent | b597cb4f7bc454f4d8c0bb7df435df1246920273 (diff) | |
download | txr-46f607ae233a8f71c09d40dd45aae5f2ec7056fc.tar.gz txr-46f607ae233a8f71c09d40dd45aae5f2ec7056fc.tar.bz2 txr-46f607ae233a8f71c09d40dd45aae5f2ec7056fc.zip |
* eval.c (eval_init): new instrinsic function /= registered.
* lib.c (numneqv): New function.
* lib.h (numneqv): Declared.
* txr.1: New function documented.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | eval.c | 1 | ||||
-rw-r--r-- | lib.c | 12 | ||||
-rw-r--r-- | lib.h | 1 | ||||
-rw-r--r-- | txr.1 | 15 |
5 files changed, 39 insertions, 0 deletions
@@ -1,3 +1,13 @@ +2012-09-11 Kaz Kylheku <kaz@kylheku.com> + + * eval.c (eval_init): new instrinsic function /= registered. + + * lib.c (numneqv): New function. + + * lib.h (numneqv): Declared. + + * txr.1: New function documented. + 2012-09-10 Kaz Kylheku <kaz@kylheku.com> * match.c (v_collect): Bug in processing of @(last) directive. @@ -2228,6 +2228,7 @@ void eval_init(void) reg_fun(intern(lit(">="), user_package), func_n1v(gev)); reg_fun(intern(lit("<="), user_package), func_n1v(lev)); reg_fun(intern(lit("="), user_package), func_n1v(numeqv)); + reg_fun(intern(lit("/="), user_package), func_n0v(numneqv)); reg_fun(intern(lit("max"), user_package), func_n1v(maxv)); reg_fun(intern(lit("min"), user_package), func_n1v(minv)); @@ -1414,6 +1414,18 @@ val numeqv(val first, val rest) return t; } +val numneqv(val list) +{ + val i, j; + + for (i = list; i; i = cdr(i)) + for (j = cdr(i); j; j = cdr(j)) + if (numeq(car(i), car(j))) + return nil; + + return t; +} + val max2(val anum, val bnum) { return if3(ge(anum, bnum), anum, bnum); @@ -450,6 +450,7 @@ val ltv(val first, val rest); val gev(val first, val rest); val lev(val first, val rest); val numeqv(val first, val rest); +val numneqv(val list); val max2(val anum, val bnum); val min2(val anum, val bnum); val maxv(val first, val rest); @@ -8377,6 +8377,21 @@ undergo two different conversions. For instance in (< <float> <character> its Unicode, and if that comparison suceeds, then in the second comparison, the character will convert to integer. +.SS Function /= + +.TP +Syntax: + + (/= <number>*) + +.TP +Description: + +The arguments to /= may be numbers or characters. The /= function returns t if +no two of its arguments are numerically equal. That is to say, if there exist +some a and b which are distinct arguments such that (= a b) is true, then +teh function returns nil. Otherwise it returns t. + .SS Functions max and min .TP |