[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lambda The Ultimate: use failure-thunk instead of default value?



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: atehwa@xxxxxx, +35841 5323835, +3589 85619369
work contact: pkalliok@xxxxxxxxxxxxxxxx, +35850 3678003
kotisivu (henkkoht):	http://www.iki.fi/atehwa/
homepage (technical):	http://sange.fi/~atehwa/