It was mentioned here once before (by David Van Horn) that
"hash-table-ref/default hash-table key default -> value"
is not "equivalent to"
(hash-table-ref hash-table key (lambda () default)).
This could perhaps be written in terms of an actual definition of
hash-table-ref/default, since the current language is ambiguous:
[proposed text]
Procedure: hash-table-ref/default hash-table key default -> value
Behaves as if defined by
(define (hash-table-ref/default ht key default-value)
(hash-table-ref ht key (lambda () default-value)))
[end proposed text]
That clears up any confusion about whether "default" is a variable or a
metavariable :-)
A similar definition could be used for hash-table-update!/default, as
well - and the code snippet in "hash-table-update!" could be replaced by
a full definition, too, to make the roles of the identifiers crystal clear:
[proposed text]
Procedure: hash-table-update! hash-table key function [ thunk ]
-> undefined
Semantically equivalent to, but may be implemented more
efficiently than, the following code:
(define (hash-table-update! ht key fn . maybe-thunk)
(hash-table-set! ht key
(fn (apply hash-table-ref ht key maybe-thunk))))
[end proposed text]
Tony