accelerationnet / function-cache Goto Github PK
View Code? Open in Web Editor NEWA Common Lisp function caching / memoization library
A Common Lisp function caching / memoization library
Please consider adding :description, :author and :license information to your ASDF system(s). This will greatly help Quicklisp users and make it easier for them to report bugs.
More information:
http://blog.quicklisp.org/2015/05/looking-for-more-metadata.html
https://www.quicklisp.org
I get this:
; file: /home/quicklisp/quicklisp-controller/dist/build-cache/function-cache/7173aaa4e9e260108f1e3d2cab7a00327cacb9e1/function-cache-20181015-git/test/metering.lisp
; in: DEFCACHED (TEST-METERED :CACHE-CLASS (QUOTE METERED-CACHE))
; (FUNCTION-CACHE:DEFCACHED (FUNCTION-CACHE-TEST::TEST-METERED :CACHE-CLASS
; 'FUNCTION-CACHE-TEST::METERED-CACHE)
; (FUNCTION-CACHE-TEST::A)
; FUNCTION-CACHE-TEST::A)
;
; caught ERROR:
; (during macroexpansion of (DEFCACHED (TEST-METERED :CACHE-CLASS ...) ...))
; The value A is not of type LIST
Unhandled UIOP/LISP-BUILD:COMPILE-FILE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING {10005305B3}>: COMPILE-FILE-ERROR while compiling #<CL-SOURCE-FILE "function-cache-test" "test" "metering">
If I have a cache for a function f, I'd like to be able to clear that cache by doing (clear-cache 'f)
, rather than remembering the syntax for naming the cache's special variable. Is that possible with the code right now? I couldn't tell from the documentation and a quick look through the source.
If it's not available, I was thinking of adding it via a method for symbols in clear-cache
. I'm not sure exactly how I'd do it -- one option would be to stash the name of the special on the symbol-plist of f and then fetching the cache with symbol-value
.
Would a patch like that be accepted, or is it philosophically or otherwise incompatible with the goals of function-cache?
In test/function-cache.lisp it calls make-hash-table with :synchronized t, which is not a standard keyword and should give an error on implementations that don't recognize it.
On LispWorks at least, hash-tables are by default "synchronized", i.e. safe to access from multiple threads.
PLAYGROUND> (function-cache:defcached factorial-rec (x)
(if (= x 0)
1
(* x (factorial-rec (1- x)))))
; in: DEFCACHED FACTORIAL-REC
; (FNCACHE.PLAYGROUND::FACTORIAL-REC (1- FNCACHE.PLAYGROUND::X))
;
; caught STYLE-WARNING:
; undefined function: FACTORIAL-REC
;
; compilation unit finished
; Undefined function:
; FACTORIAL-REC
; caught 1 STYLE-WARNING condition
FACTORIAL-REC
I have not confirmed for myself, but I just saw this on #lisp:
18:00 <Fare> I see a bug -- he exports compute-cache-key, but defines and uses compute-cashe-key
In SBCL, if I define a (defcached foo ...)
and try to use the name foo
in other functions in the same file, I got an undefined variable
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.