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

Re: [Scheme-reports] Seeking review of sets and hash tables proposals

On Tue, May 28, 2013 at 10:51 AM, John Cowan <cowan@x> wrote:
Alex Shinn scripsit:

> I also think the following utility is nice, as there is no other
> existing utility to use a hash-table as a cache with a single
> operation:
>   (hash-table-ref/cache! table key thunk)
>   => (hash-table-search
>       table key
>       (lambda (value update remove)
>         value)
>       (lambda (insert)
>         (let ((res (thunk)))
>           (insert res)
>           res)))

How is this different from hash-table-replace?

Actually, it would appear to be equivalent to hash-table-extend!.


Scheme-reports mailing list