SRFI 69 update
David Van Horn
(30 Aug 2005 20:56 UTC)
|
Re: SRFI 69 update Tony Garnock-Jones (30 Aug 2005 23:19 UTC)
|
hash-table-*/default (Re: SRFI 69 update)
Panu Kalliokoski
(31 Aug 2005 07:56 UTC)
|
Re: hash-table-*/default (Re: SRFI 69 update)
Tony Garnock-Jones
(31 Aug 2005 08:36 UTC)
|
Re: hash-table-*/default (Re: SRFI 69 update)
Panu Kalliokoski
(31 Aug 2005 12:44 UTC)
|
Re: hash-table-*/default (Re: SRFI 69 update)
Tony Garnock-Jones
(31 Aug 2005 19:30 UTC)
|
Re: hash-table-*/default (Re: SRFI 69 update)
Panu Kalliokoski
(01 Sep 2005 05:49 UTC)
|
Re: SRFI 69 update Tony Garnock-Jones 30 Aug 2005 23:18 UTC
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