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? Tony Garnock-Jones (07 Jul 2005 13:14 UTC)

Re: Lambda The Ultimate: use failure-thunk instead of default value? Tony Garnock-Jones 07 Jul 2005 13:14 UTC

Panu Kalliokoski wrote:
> I've also thought about this.  I know the thunk version is more
> expressive.  However, I also think that a simple default value is the
> common case.  I'd like to have both.

Another alternative might be to have either

  ;; I prefer this option
  (hash-table-get ht key [failure-thunk])
  (hash-table-get/default ht key default)

or

  ;; However, this would also work
  (hash-table-get ht key [default])
  (hash-table-get/failure-continuation ht key failure-thunk)

perhaps spelling hash-table-get/failure-continuation as hash-table-get/fk.

Tony