Lambda The Ultimate: use failure-thunk instead of default value? Tony Garnock-Jones (07 Jul 2005 09:58 UTC)
Re: Lambda The Ultimate: use failure-thunk instead of default value? Panu A Kalliokoski (08 Jul 2005 14:19 UTC)

Re: Lambda The Ultimate: use failure-thunk instead of default value? Panu A Kalliokoski 08 Jul 2005 14:19 UTC

On Thu, Jul 07, 2005 at 02:14:03PM +0100, Tony Garnock-Jones wrote:
> Another alternative might be to have either
>   (hash-table-get ht key [failure-thunk])
>   (hash-table-get/default ht key default)

Yet another alternative would be to have
(hash-table-get* ht key [thunk])
and
(define-syntax hash-table-get
  (syntax-rules ()
    ((_ ht key) (hash-table-get* ht key))
    ((_ ht key expr ...) (hash-table-get* ht key (lambda () expr ...)))))

but maybe people don't like macros for such simple stuff.

Panu

--
personal contact: xxxxxx@iki.fi, +35841 5323835, +3589 85619369
work contact: xxxxxx@ling.helsinki.fi, +35850 3678003
kotisivu (henkkoht):	http://www.iki.fi/atehwa/
homepage (technical):	http://sange.fi/~atehwa/