SRFI 69's make-hash-table does not accept the R7RS version of equal?

Create issue
Issue #270 resolved
Marc Nieper-Wißkirchen created an issue

The following code works:

(import (srfi 69))
(import (rnrs))
(make-hash-table equal?)

This one doesn’t:

(import (srfi 69))
(import (scheme base))
(make-hash-table equal?)

The result of the second invocation is:

Unhandled exception
  Condition components:
  1. &assertion
  2. &who make-hash-table
  3. &message unknown equivalent procedure
  4. &irritants (#<subr equal? 2:0>)
  5. &stack-trace

stack trace:
  [1] assertion-violation
  [2] eval
  [3] #f
    src: ((current-evaluator) form interactive-environment)
  [4] with-error-handler
  [5] read-eval-print-loop
    src: (call-with-current-continuation (lambda (continue)
  [6] eval

We probably need another clause here:

diff --git a/sitelib/srfi/%3a69/basic-hash-tables.scm b/sitelib/srfi/%3a69/basic-hash-tables.scm
index d8f61be..57195e1 100644
--- a/sitelib/srfi/%3a69/basic-hash-tables.scm
+++ b/sitelib/srfi/%3a69/basic-hash-tables.scm
@@ -55,6 +55,7 @@
                  (eq-hash    hash-by-identity))
          string-hash string-ci-hash)
   (import (rnrs)
+         (prefix (scheme base) r7rs:)
          ;; make-string-hashtable and make-equal-hashtable
          (sagittarius control)
@@ -68,6 +69,7 @@
       (cond ((eq? eql? eq?)         (make-eq-hashtable))
            ((eq? eql? eqv?)        (make-eqv-hashtable))
            ((eq? eql? equal?)      (make-equal-hashtable))
+           ((eq? eql? r7rs:equal?) (make-equal-hashtable))
            ((eq? eql? string=?)    (make-string-hashtable))
            ((eq? eql? string-ci=?) (make-hashtable string-ci=? string-ci-hash))

Comments (2)

  1. Log in to comment