diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | hash.c | 10 | ||||
-rw-r--r-- | hash.h | 2 | ||||
-rw-r--r-- | txr.1 | 2 |
5 files changed, 26 insertions, 0 deletions
@@ -1,5 +1,15 @@ 2011-12-10 Kaz Kylheku <kaz@kylheku.com> + * eval.c (eval_init): New functions added as intrinsics. + + * hash.c (hash_eql, hash_equal): New external functions. + + * hash.h (hash_eql, hash_equal): Declared. + + * txr.1: Sections added. + +2011-12-10 Kaz Kylheku <kaz@kylheku.com> + * mpi-patches/add-mp-hash: Rewrote mp_hash to only hash enough low-order bit material from the bignum to fill an unsigned long. We don't need to walk the entire bignum. If the low order @@ -1180,6 +1180,8 @@ void eval_init(void) func_n2(set_hash_userdata)); reg_fun(intern(lit("hashp"), user_package), func_n1(hashp)); reg_fun(intern(lit("maphash"), user_package), func_n2(maphash)); + reg_fun(intern(lit("hash-eql"), user_package), func_n1(hash_eql)); + reg_fun(intern(lit("hash-equal"), user_package), func_n1(hash_equal)); reg_fun(intern(lit("eval"), user_package), func_n2(eval_intrinsic)); @@ -408,6 +408,16 @@ val maphash(val fun, val hash) return nil; } +val hash_eql(val obj) +{ + return num(eql_hash(obj) % NUM_MAX); +} + +val hash_equal(val obj) +{ + return num(equal_hash(obj) % NUM_MAX); +} + /* * Called from garbage collector. Hash module must process all weak tables * that were visited during the marking phase, maintained in the list @@ -40,6 +40,8 @@ val hashp(val obj); val maphash(val func, val hash); val hash_begin(val hash); val hash_next(val *iter); +val hash_eql(val obj); +val hash_equal(val obj); void hash_process_weak(void); @@ -4835,6 +4835,8 @@ The following are Lisp functions and variables built-in to TXR. .SS Function maphash +.SS Functions hash-eql and hash-equal + .SS Function eval .SS Variables *stdout*, *stdin* and *stderr* |