From patchwork Fri Feb 4 00:24:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reily Siegel X-Patchwork-Id: 36966 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 8951027BBEA; Fri, 4 Feb 2022 00:25:16 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 4AB4227BBE9 for ; Fri, 4 Feb 2022 00:25:16 +0000 (GMT) Received: from localhost ([::1]:46956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFmPb-0000aO-Fd for patchwork@mira.cbaines.net; Thu, 03 Feb 2022 19:25:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFmPP-0000Vo-Ql for guix-patches@gnu.org; Thu, 03 Feb 2022 19:25:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:36173) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nFmPP-0001of-HV for guix-patches@gnu.org; Thu, 03 Feb 2022 19:25:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nFmPP-00005D-Ex for guix-patches@gnu.org; Thu, 03 Feb 2022 19:25:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53765] [PATCH 05/17] 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: Fri, 04 Feb 2022 00:25:03 +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 Received: via spool by 53765-submit@debbugs.gnu.org id=B53765.164393429632733 (code B ref 53765); Fri, 04 Feb 2022 00:25:03 +0000 Received: (at 53765) by debbugs.gnu.org; 4 Feb 2022 00:24:56 +0000 Received: from localhost ([127.0.0.1]:58298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFmPI-0008Vs-BX for submit@debbugs.gnu.org; Thu, 03 Feb 2022 19:24:56 -0500 Received: from mout-p-202.mailbox.org ([80.241.56.172]:51136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFmPG-0008VQ-AW for 53765@debbugs.gnu.org; Thu, 03 Feb 2022 19:24:55 -0500 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-202.mailbox.org (Postfix) with ESMTPS id 4Jqbrw4W33z9sTF for <53765@debbugs.gnu.org>; Fri, 4 Feb 2022 01:24:48 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=reilysiegel.com; s=MBO0001; t=1643934286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=QD8ZqXRzdm/dI5eEF+uKWycHi2dEbUtN/LNfKbrHyOY=; b=Hy+3HmIUB4R1Qi3BrtzCyWbZgW9TtZZ5Owt5ccP64gnVrNWQVeCsuMyv3KlcxYYxsAJMiU uUBWez4vUI0kO96DrXYs+YE3Gu4m/59TK+NxOU1JYRUfqKq5gCVNvRSTe+07mk5aymsBYW Nj/0BUnLnr3vW4aXUiR2vBdtKqFJLN5pO4jIn9OQ7CIDYtzgwCtJCwEnSbQ58LHzW3pDUH 7UsfarXcrWP8qiopjT/p7j6MTCodKP7JsvNSI9oC9rzPkcyDltjcSMjoHJtHy5cupeR5rW ucl9pYsOPsYolXpk0oKMZDvJd7vx91mlZkFuzaO+1epUZ2dFfzLylrdzHvER8g== From: Reily Siegel Date: Thu, 03 Feb 2022 19:24:42 -0500 Message-ID: <87r18j32d1.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 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")