From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.lisp.guile.bugs Subject: bug#74385: [PATCH 3/4] srfi-64: Export define-equality-test. Date: Sat, 16 Nov 2024 18:42:06 +0100 Message-ID: <20241116174210.9160-3-~@wolfsden.cz> References: <20241116174210.9160-1-~@wolfsden.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19334"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tomas Volf <~@wolfsden.cz>, Janneke Nieuwenhuizen To: 74385@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Nov 16 18:43:40 2024 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tCMpf-0004qA-Ei for guile-bugs@m.gmane-mx.org; Sat, 16 Nov 2024 18:43:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCMp7-0007nQ-FI; Sat, 16 Nov 2024 12:43:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCMp5-0007mr-K8 for bug-guile@gnu.org; Sat, 16 Nov 2024 12:43:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tCMp5-0001So-Bl for bug-guile@gnu.org; Sat, 16 Nov 2024 12:43:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=/SS1rKFS/G0bDNT+UTh5B8GKSsZXlDBOqzvDwcNq9Og=; b=P9vwqEXfmRGK1zenXTSxaNFMt+8zcqEcMPchJZHDND3B72LMRxXdHup3ME0tm0vMA+4aj5IKqo5/0T0jnLGo4xviMxogzq2y9CSj/VH5iNm0KRybaTr1/N9AkJYz6Pqt0QrNygPfkIPFikmCGDmyf62gJXkQPqjlJUHPbZiGLYqWFzv58+IA49SAcY/J6vVyQnW5oH2045r1cY3yM38XgcyhuBA7RxA4PwekvoHBtj1LfJt7cMFfhYbEikNjWJXvJAxmZ09s6V6vPrJQX2TaPky6lfax23c5/dq0Bt157N8lFJp7NQt0RM3C1tKLx1ey/XQcVQNF7SwInY0jgYtqcg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCMp4-0006fi-Vv for bug-guile@gnu.org; Sat, 16 Nov 2024 12:43:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 16 Nov 2024 17:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74385 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Original-Received: via spool by 74385-submit@debbugs.gnu.org id=B74385.173177894425568 (code B ref 74385); Sat, 16 Nov 2024 17:43:02 +0000 Original-Received: (at 74385) by debbugs.gnu.org; 16 Nov 2024 17:42:24 +0000 Original-Received: from localhost ([127.0.0.1]:54682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCMoS-0006eJ-2M for submit@debbugs.gnu.org; Sat, 16 Nov 2024 12:42:24 -0500 Original-Received: from wolfsden.cz ([37.205.8.62]:40558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1tCMoL-0006dX-JO for 74385@debbugs.gnu.org; Sat, 16 Nov 2024 12:42:18 -0500 Original-Received: by wolfsden.cz (Postfix, from userid 104) id 1760D35339B; Sat, 16 Nov 2024 17:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1731778937; bh=iOUYaAROjpk3szYZQyTJjNFGRSvljo1KUFKxPo9zKjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zGtFEmwUVxUxaOHQjHms992Fv5sdZ+qA/PAw0/kzH/mSdQ102gsODz6KEPjX6K6ky RI1E03xJxzZHWoCdxKwrAv1CW+wn8PIIv1egjX8yLT/HF4sl1omERPcOogCgJG8KEp 1O0H6sFUCSfJ43nRJQCJRY6+NLHOIOX/dVtgl4EtTcGVIaBArlBZ230ohVb1V365NS Klgcq3HcTbLdmP/yAcZ4iKkuv51aAsqUNyrLT43mfQvL5WyA7Z82Kjd0FL/UFPv0Om zfnMxOIrdOzUp1wO5m05GKAfWOZL9NtCKfKdFIbtdebfJ085h44YzoaT9hAPymKrMD fDdzkLefk/VR85AFi9BWz8u/uyMtnPJZKdpfA3VVDfpDMHnZTm99+wYurxnn558FHt fDSdCkBuCJEzpfjVTKPMvm8QmarpKUaWyHxhcMg3ocFHpQ3rhypGbk7LHnBwe8eExr S641WRSww1EHGbuB+M9988JzB7d0JUa9/At/tCDAiUPd7lXzo45nRUfqSKlaWfb8yH 28XqNNIKStzJZ85jdOEU3QWvm4kk7/Svu8P7fm2G2UHYcbPzAocRhB27th7swvOWrW jLwCPdPk3f1RJhdggP8GM16Jk6gYt63eDfQSFTNuZrhxX14Fi9ZSjreCjtpMzbpJbi YS9vRO46PADxoSKThheboEJ4= Original-Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id A85F835302B; Sat, 16 Nov 2024 17:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1731778936; bh=iOUYaAROjpk3szYZQyTJjNFGRSvljo1KUFKxPo9zKjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AkOH1yFlKW+EKPVBKcPV9GZ+f8aXp8yZszMs9ttl4bh94tKBY63+XJ/vW8l5+dEoM scHV2SpZe68X7XGnnkb5DFJNxLtG/b5laRldASqmu6mmBOR+oWKxIQfwYaNUq8TFHu Pu4G+qi2v6N7Tj3+jmWsBZkED+78nRaq9Z/p4xsKxyza3NqpW0PZxwXt0tdgrA07W1 OeUT5Bv/S/9qXBTnLAPKwojj25UPCEY/+3/X5BfbXLhv1G0nLuYxcTHB7Q7mR1VwHL ZO4U1hc0v4CQ4Z14SP3bvVQ6a031UsKCixFN+4APHYaMA0cuKu5SR3CZOv5NGfhGqI 6wZlD6pLnhKSm3jNR7oz5XVLS5LzTob0bSrVFf+4gav4xwMRSm4rtpEAmP3+g0wPTA kLofl/CI9tM7Aa4XbJQ1y0tTmZepyImN6J0ZPcfARL3G2WYr+tyXEH9ilDOBj/XMOJ uxXHJdNkkvMgwXg/roZDD85rXp/s2Ip5Mxqd1ebwchYpzxgT/gY5vnib5HEf6l0ohk BbiCW0MC915M8ZGCj7PGCSVz8fbqzxileC6puz1IqMGtZ0V1NTlf7z93h9LcoLcUnU 2+B7337xq+tklhgbcwLeCZsfzifUFEXo7e3skMgqH37DLl71J31BpNDm1HurK/715/ YsjqL4sQ8feY222cP+nfLLC0= X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241116174210.9160-1-~@wolfsden.cz> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:11100 Archived-At: Interest was expressed on the mailing list to have %test-2 as a part of the public API. So rename it and export from the module. * module/srfi/srfi-64.scm (define-equality-test): Rename from %test-2. (%test-2): Rename from %%test-2. (test-eq, test-eqv, test-equal): Adjust. (define-module)<#:export>: Export it. Reported-by: Janneke Nieuwenhuizen --- module/srfi/srfi-64.scm | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/module/srfi/srfi-64.scm b/module/srfi/srfi-64.scm index 7b3341bf0..203db49ea 100644 --- a/module/srfi/srfi-64.scm +++ b/module/srfi/srfi-64.scm @@ -118,6 +118,8 @@ test-procedure? test-thunk + define-equality-test + &bad-end-name bad-end-name? bad-end-name-begin-name @@ -728,7 +730,7 @@ to invoke @code{test-assert} if there is no current test runner. @end defspec") -(define-syntax %%test-2 +(define-syntax %test-2 (λ (x) (syntax-case x () ((_ syn test-proc test-name expected test-expr) @@ -742,20 +744,34 @@ to invoke @code{test-assert} if there is no current test runner. (test-result-set! r 'actual-value a) (test-proc e a)))))))) -(define-syntax %test-2 +(define-syntax define-equality-test (syntax-rules () ((_ name test-proc) (define-syntax name (λ (x) (syntax-case x () ((_ test-name expected test-expr) - #`(%%test-2 #,x test-proc test-name expected test-expr)) + #`(%test-2 #,x test-proc test-name expected test-expr)) ((_ expected test-expr) - #`(%%test-2 #,x test-proc #f expected test-expr)))))))) + #`(%test-2 #,x test-proc #f expected test-expr)))))))) +(set-documentation! 'define-equality-test + "@defspec define-equality-test identifier proc +Define a new test form named @var{identifier} with same signature and usage as +@code{test-eq} but using @var{proc} instead of @code{eq?}. -(%test-2 test-eq eq?) -(%test-2 test-eqv eqv?) -(%test-2 test-equal equal?) +For example, the provided equality checks are defined as: + +@lisp +(define-equality-test test-eq eq?) +(define-equality-test test-eqv eqv?) +(define-equality-test test-equal equal?) +@end lisp + +@end defspec") + +(define-equality-test test-eq eq?) +(define-equality-test test-eqv eqv?) +(define-equality-test test-equal equal?) (set-documentation! 'test-eq "@defspec test-eq test-name expected test-expr -- 2.46.0