Re: Memoize improvement

2009-10-31 Thread John Harrop
Actually, the code I posted might behave less well if the timing is less uniform. It's better to store wait times with queue entries rather than with cache entries: (defn my-memoize "Returns a memoized version of a referentially transparent function. The memoized version of the function keeps

Re: Memoize improvement

2009-10-31 Thread John Harrop
On Fri, Oct 30, 2009 at 7:57 PM, Stefan Arentz wrote: > This is some of my first Clojure code so it might not be the > greatest ... yet! > It's quite interesting. (defn my-memoize > "Returns a memoized version of a referentially transparent > function. The > memoized version of the function

Memoize improvement

2009-10-30 Thread Stefan Arentz
This is some of my first Clojure code so it might not be the greatest ... yet! Here is an improved memoize function that also takes a time-to-live argument. Useful when you want to expire results from the cache. I'm using it to cache query results from a database. This probably breaks som