From: Taylor R Campbell Date: Wed, 8 Jun 2011 18:21:07 +0000 (+0000) Subject: Fix order of arguments to HASH-TABLE/MODIFY!. X-Git-Tag: 20110609-Gtk~1^2~1 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3153bf0b3e72eba7043a0e1f9d14a6bf78bf1d27;p=mit-scheme.git Fix order of arguments to HASH-TABLE/MODIFY!. With any luck, nobody was using this except me outside the tree. And it's not documented, so that nobody character will get what he deserves. Before: (hash-table/modify! hash-table key (lambda () ... a gigantic heffable hoary herralump of an expression ...) tiny) After: (hash-table/modify! hash-table key tiny (lambda () ... a gigantic heffable hoary herralump of an expression ...)) --- diff --git a/src/imail/imail-imap.scm b/src/imail/imail-imap.scm index a4fcb8278..f0f18bb15 100644 --- a/src/imail/imail-imap.scm +++ b/src/imail/imail-imap.scm @@ -1378,9 +1378,8 @@ USA. (let ((keywords (select-uncached-keywords message keywords))) (if (pair? keywords) (begin - (hash-table/modify! message-sets keywords - (lambda (messages) (cons message messages)) - '()) + (hash-table/modify! message-sets keywords '() + (lambda (messages) (cons message messages))) (set! count (+ count 1))))))))))) (values message-sets count))) diff --git a/src/runtime/hashtb.scm b/src/runtime/hashtb.scm index acb098d4f..3e85fa199 100644 --- a/src/runtime/hashtb.scm +++ b/src/runtime/hashtb.scm @@ -136,18 +136,14 @@ USA. (guarantee-hash-table table 'HASH-TABLE/PUT!) ((table-type-method:put! (table-type table)) table key datum)) -(define (hash-table/modify! table key procedure default) +(define (hash-table/modify! table key default procedure) (guarantee-hash-table table 'HASH-TABLE/MODIFY!) - ((table-type-method:modify! (table-type table)) table key procedure default)) + ((table-type-method:modify! (table-type table)) table key default procedure)) -(define (hash-table/intern! table key get-datum) - (hash-table/modify! table - key - (lambda (datum) - (if (eq? datum default-marker) - (get-datum) - datum)) - default-marker)) +(define (hash-table/intern! table key generator) + (hash-table/modify! table key default-marker + (lambda (datum) + (if (eq? datum default-marker) (generator) datum)))) (define (hash-table/remove! table key) (guarantee-hash-table table 'HASH-TABLE/REMOVE!) @@ -645,7 +641,7 @@ USA. (define (make-method:modify! compute-hash! key=? entry-type) (declare (integrate-operator compute-hash! key=? entry-type)) - (define (method:modify! table key procedure default) + (define (method:modify! table key default procedure) (let ((hash (compute-hash! table key))) (let loop ((p (vector-ref (table-buckets table) hash)) (q #f)) (if (pair? p)