From f2d6cac2d9eb68f5429fc0bae3056fbcda4f71dc Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Mon, 21 Dec 2009 15:11:16 -0500 Subject: [PATCH] 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. --- src/runtime/hashtb.scm | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) 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) -- 2.25.1