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

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

On Sun, May 26, 2013 at 7:49 AM, Alexey Radul <axch@x> wrote:

2) Universal lookup procedure

I am fond of the following universal lookup procedure [1]:
  (hash-table-search table key
    (lambda (value update remove)
    (lambda (insert)

This is very nice, and it's important to provide fundamental
operations such as this which allow arbitrary ref+update logic
without requiring the hash to be recomputed.  This is not
possible in either the SRFI-69 or R6RS APIs (though an impl
may cache one or more recently hashed values).

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

  (hash-table-ref/cache! table key thunk)
  => (hash-table-search
      table key
      (lambda (value update remove)
      (lambda (insert)
        (let ((res (thunk)))
          (insert res)


Scheme-reports mailing list