diff mbox series

[bug#53765,05/17] gnu: Add clojure-core-memoize.

Message ID 87r18j32d1.fsf@reilysiegel.com
State New
Headers show
Series Remove limitations on clojure-tools | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Reily Siegel Feb. 4, 2022, 12:24 a.m. UTC
* gnu/packages/clojure.scm (clojure-core-memoize): New variable.
---
 gnu/packages/clojure.scm | 51 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
index d390feff3d..a0350290e5 100644
--- a/gnu/packages/clojure.scm
+++ b/gnu/packages/clojure.scm
@@ -341,6 +341,57 @@  (define-public clojure-core-match
       (home-page "https://github.com/clojure/core.match")
       (license license:epl1.0))))
 
+(define-public clojure-core-memoize
+  (package
+    (name "clojure-core-memoize")
+    (version "1.0.253")
+    (home-page "https://github.com/clojure/core.memoize")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url home-page)
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1qky54v114sh3xn0lffwy7xx3wnnayk07fr2nvhd4lih84sv6rdz"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure")
+       #:test-dirs '("src/test/clojure")
+       #:doc-dirs '("docs")
+       ;; Tests fail when AOT'd.
+       #:aot-exclude '(#:all)))
+    (propagated-inputs (list clojure-core-cache))
+    (synopsis "Manipulable, pluggable, memoization framework for Clojure")
+    (description "@code{core.memoize} is a Clojure contrib library providing
+the following features:
+
+An underlying PluggableMemoization protocol that allows the use of
+customizable and swappable memoization caches that adhere to the synchronous
+CacheProtocol found in core.cache
+
+Memoization builders for implementations of common caching strategies,
+including:
+
+First-in-first-out (clojure.core.memoize/fifo)
+
+Least-recently-used (clojure.core.memoize/lru)
+
+Least-used (clojure.core.memoize/lu)
+
+Time-to-live (clojure.core.memoize/ttl)
+
+Naive cache (memo) that duplicates the functionality of Clojure's memoize
+function but, unlike the built-in memoize function, ensures that in the case
+of concurrent calls with the same arguments, the memoized function is only
+invoked once; in addition memo can use metadata from the memoized function to
+ignore certain arguments for the purpose of creating the cache key, e.g.,
+allowing you to memoize clojure.java.jdbc functions where the first argument
+includes a (mutable) JDBC Connection object by specifying
+:clojure.core.memoize/args-fn rest in the metadata")
+    (license license:epl1.0)))
+
 (define-public clojure-data-codec
   (package
     (name "clojure-data-codec")