summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-10 12:20:03 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-10 12:22:54 -0800
commit497cd7dee0ca67644d92eeefac277e89361d3053 (patch)
tree3ebf0bbf69c1f900a067432694bc91490086f3aa
parent64eb78436c46c1c6eecba1093a9072ff829209c4 (diff)
downloadtxr-497cd7dee0ca67644d92eeefac277e89361d3053.tar.gz
txr-497cd7dee0ca67644d92eeefac277e89361d3053.tar.bz2
txr-497cd7dee0ca67644d92eeefac277e89361d3053.zip
* 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.
-rw-r--r--ChangeLog10
-rw-r--r--eval.c2
-rw-r--r--hash.c10
-rw-r--r--hash.h2
-rw-r--r--txr.12
5 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 96acf6dd..e9380e95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/eval.c b/eval.c
index 43a98305..9f9ce124 100644
--- a/eval.c
+++ b/eval.c
@@ -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));
diff --git a/hash.c b/hash.c
index 214d4e8f..892dfa5c 100644
--- a/hash.c
+++ b/hash.c
@@ -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
diff --git a/hash.h b/hash.h
index 367ccfff..a5a7ba06 100644
--- a/hash.h
+++ b/hash.h
@@ -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);
diff --git a/txr.1 b/txr.1
index ae7e2972..1cb30487 100644
--- a/txr.1
+++ b/txr.1
@@ -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*