On Tue, May 28, 2013 at 10:51 AM, John Cowan <[email protected]> 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!.

-- 
Alex
_______________________________________________
Scheme-reports mailing list
[email protected]
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

Reply via email to