From: Taylor R Campbell Date: Mon, 21 Dec 2009 20:11:16 +0000 (-0500) Subject: Reflect specification bug in definition of HASH-TABLE-UPDATE!. X-Git-Tag: 20100708-Gtk~193 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f2d6cac2d9eb68f5429fc0bae3056fbcda4f71dc;p=mit-scheme.git Reflect specification bug in definition of HASH-TABLE-UPDATE!. We can't use HASH-TABLE/MODIFY! because the specification tacitly permits the procedure to edit the hash table. This was a silly oversight in the SRFI document. --- diff --git a/src/runtime/hashtb.scm b/src/runtime/hashtb.scm index a0fa9274c..e5fe7f896 100644 --- a/src/runtime/hashtb.scm +++ b/src/runtime/hashtb.scm @@ -840,19 +840,16 @@ USA. datum))) (define (hash-table-update! table key procedure #!optional get-default) - (hash-table/modify! table - key - (if (default-object? get-default) - (lambda (datum) - (if (eq? datum default-marker) - (error:bad-range-argument key - 'HASH-TABLE-UPDATE!)) - (procedure datum)) - (lambda (datum) - (procedure (if (eq? datum default-marker) - (get-default) - datum)))) - default-marker)) + (hash-table-set! + table + key + (procedure + (hash-table-ref table + key + (if (default-object? get-default) + (lambda () + (error:bad-range-argument key 'HASH-TABLE-UPDATE!)) + get-default))))) (define (hash-table-copy table) (guarantee-hash-table table 'HASH-TABLE-COPY)