From patchwork Wed Mar 16 12:43:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reily Siegel X-Patchwork-Id: 37867 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 29EB527BBEA; Wed, 16 Mar 2022 12:56:47 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DB61527BBE9 for ; Wed, 16 Mar 2022 12:56:46 +0000 (GMT) Received: from localhost ([::1]:42420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUTCn-00049w-O7 for patchwork@mira.cbaines.net; Wed, 16 Mar 2022 08:56:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUT1S-00078S-Q1 for guix-patches@gnu.org; Wed, 16 Mar 2022 08:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUT1S-0004VB-DF for guix-patches@gnu.org; Wed, 16 Mar 2022 08:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nUT1S-0001kF-BV for guix-patches@gnu.org; Wed, 16 Mar 2022 08:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#53765] [PATCH v2 05/18] gnu: Add clojure-core-memoize. References: <87y22r32hi.fsf@reilysiegel.com> In-Reply-To: <87y22r32hi.fsf@reilysiegel.com> Resent-From: Reily Siegel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Mar 2022 12:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53765 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53765@debbugs.gnu.org Cc: Maxime Devos Received: via spool by 53765-submit@debbugs.gnu.org id=B53765.16474346486447 (code B ref 53765); Wed, 16 Mar 2022 12:45:02 +0000 Received: (at 53765) by debbugs.gnu.org; 16 Mar 2022 12:44:08 +0000 Received: from localhost ([127.0.0.1]:50533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUT0Z-0001fu-Px for submit@debbugs.gnu.org; Wed, 16 Mar 2022 08:44:08 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]:41186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUT0W-0001eI-5I for 53765@debbugs.gnu.org; Wed, 16 Mar 2022 08:44:04 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [80.241.60.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4KJVML2QYGz9sW3; Wed, 16 Mar 2022 13:43:58 +0100 (CET) From: Reily Siegel DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=reilysiegel.com; s=MBO0001; t=1647434638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=6fPmdcWUyry7/sz8KHi8h0PQbIUrFDTTTUFFYP8kJGg=; b=jVBPHR45nJ+E/qszp+j1uC8YvJzBfYe+u9IjFZya+CPIDCE27GlGkoKXFYBjyArCEw8Q1w bvFfhaEWnTFUPSK+bwt4mNvtE3NTGMD4gV49LqKwknN4yqebvOboNnRmWU+SxieOep8+zO vvacjPnkCOj/5x9ZOhsiKzy8bfsR9ZjlaGvw7+bF6RlrPLn+6NfKPtTmXz/5n5w/PSfHOv 6eFAXdEWCBg8uEsRpyfXikSEzVSDIiBs1wOA5S4oHbFRvXS3SPk/xkmr6WzSVabHK8tIhq W5ZDgS2Ytu8rZeUxytK20FDqoUpO8NuXCFqwCm7dYhyOGtZE4Vg4SXWuIt1IhQ== Date: Wed, 16 Mar 2022 13:43:55 +0100 Message-ID: <877d8udq44.fsf@reilysiegel.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/clojure.scm (clojure-core-memoize): New variable. --- gnu/packages/clojure.scm | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm index 37cea74c95..d6c8218f93 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")