From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: Re: comparator in match pattern Date: Wed, 28 Jun 2023 22:52:29 +0200 Message-ID: References: <54a4a4766d2316d737c299491c6f750af369bb33.camel@planete-kraus.eu> <1568359c8cdec032ea4c6cdd23a8039452a3a6f2.camel@planete-kraus.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26425"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Jun 28 22:53:12 2023 Return-path: Envelope-to: guile-user@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 1qEcA2-0006bp-R1 for guile-user@m.gmane-mx.org; Wed, 28 Jun 2023 22:53:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEc9e-0004LL-43; Wed, 28 Jun 2023 16:52:46 -0400 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 1qEc9c-0004LA-Vf for guile-user@gnu.org; Wed, 28 Jun 2023 16:52:44 -0400 Original-Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEc9b-0001n5-6q for guile-user@gnu.org; Wed, 28 Jun 2023 16:52:44 -0400 Original-Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f95bf5c493so106551e87.3 for ; Wed, 28 Jun 2023 13:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687985561; x=1690577561; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EgmhHj+Sez6cuZtdscRvA8PiqppQQx9KWassjNuqRM8=; b=TNblgI/eofil7Tx787OLhUwJqW5GPZvYmmqxwIFrLwNcYGtBweZQSSc0A8bmIe9zsi WcFsFAmBaav2L/Z6DnhNJuXUVOOqub40/MoNM5/O5sEnTiwiJ04kL4MpO91MvYmFMZ7a 7LH5laQNhKJg5w4X4M56qb2oBlR24kMZr4GF9DKuLZPq8u8cHxC0tB6K5hkrIFdeHTe8 wV7k+P5UtQvz7ZQyJnYyMHgUOCOd+28T9WfjMdhzbxNgYWuqsnhHTcsjxihM9/7JT7mq uGtX2QjeGZmgfBbG2TX/5+EObK/y/UcwvLc6xe5VS8UEhTM/JgphSR1ZWa13ktYacDX5 LE0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687985561; x=1690577561; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EgmhHj+Sez6cuZtdscRvA8PiqppQQx9KWassjNuqRM8=; b=hsEt5wV/netPQ9vpRA26N8PaqMmCbrekMMmHvdRqabL9FueZCnP5bYZjSUBVHmX2j3 Ye9YG7EMlZreu22DekEgtWvp9x8DqO6DBaF7BX/KNREyaS9QYs3Pf0QzLj3/FrDZcMcG m7DnPf6JSLjhIQ4qypY4e+X/Tdzsluw6RzeVdqfMGzXEitnL14iSpyDrT/W4MQN84pOg a8k9XZl4UTdsGY4Clzs0sT9NcVvE5gKVSrevD9fml3xnKaJgOTzOafmXs//96tGID/x2 oD90AVd/qo9Cc7eHo+c3dWACnfZEzjUwUi+BXz80XPx7IUixXlvG6QecBUg2LJ1CBofM veXA== X-Gm-Message-State: AC+VfDyHvI+Qfz50uskA5Gv3EWKCU9exyfvz1RtTj4JCMGvNysI9vWue 88bXA4ZK+pEb51kGoG4FIJVDCt2HfBoEOnezgBsI7aZUPEk= X-Google-Smtp-Source: ACHHUZ7QUwkDXo5LjkfqQbNq3MwitY/Axnvwk5Nm3twOWKh4MQquDiYcfkbmJ4fBLt87m7H0sm7ilSelk1B2ad+THjc= X-Received: by 2002:a05:6512:3ca9:b0:4fb:78a0:dd32 with SMTP id h41-20020a0565123ca900b004fb78a0dd32mr8629597lfv.60.1687985560881; Wed, 28 Jun 2023 13:52:40 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=damien.mattei@gmail.com; helo=mail-lf1-x12a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19082 Archived-At: seems to works now: scheme@(guile-user)> (match (list 1 /) ((c (? (cut equal? <> /))) 'cool)) $2 =3D cool On Wed, Jun 28, 2023 at 9:47=E2=80=AFPM Damien Mattei wrote: > > thank you, ok , i understand ,my Scheme+ redefined <> to not =3D , this > was the problem, i apologize > > On Wed, Jun 28, 2023 at 5:27=E2=80=AFPM Vivien Kraus wrote: > > > > Le mercredi 28 juin 2023 =C3=A0 17:10 +0200, Damien Mattei a =C3=A9crit= : > > > Vivien , your solution is not working: > > > > > > (let ((/ 42)) > > > (match (list 1 42) > > > ((c (? (cut equal? <> /))) > > > c))) > > > ;;; :30:2: warning: wrong number of arguments to `# > > (lambda () (lambda-case ((() #f #f #f () ()) (call (toplevel equal?) > > > (toplevel <>) (lexical / /-1dff1b83541ce327-407)))))>' > > > ice-9/boot-9.scm:1685:16: In procedure raise-exception: > > > Wrong number of arguments to 42 > > > > It works on my side (see screenshot). You did not quote the module > > import line in your reply, did you forget to paste it? > > > > (use-modules (ice-9 match) (srfi srfi-26)) > > > > Otherwise it is likely a problem with your guile installation, and I > > can=E2=80=99t really help. > > > > > and / is not a variable , it is simply a separator , the / procedure > > > too,and it is not quoted > > > > I do not understand. Do you want to match against the '/ symbol or the > > variable/procedure bound to "/"? > > > > If you want to match against something that is bound to "/", then the > > cut-equal solution is relevant. If you want to match against the / > > symbol, then you can do either one of these: > > > > (use-modules (ice-9 match)) > > (match (list 1 '/) > > (`(,c /) > > c)) > > > > or > > > > (use-modules (ice-9 match)) > > (match (list 1 '/) > > ((c '/) > > c)) > > > > > in Racket this works: > > > > > > (match (list container index1-or-keyword index2-or-keyword) > > > > > > ((list c (=3D=3D /) (=3D=3D /)) (displayln "T[/ /]")) > > > > This is not a self-contained example, I don=E2=80=99t know what is inde= x*-or- > > keyword. Is it the division function or whatever is bound to / at that > > time? The / symbol? > > > > Vivien