seems to works now: scheme@(guile-user)> (match (list 1 /) ((c (? (cut equal? <> /))) 'cool)) $2 = cool
On Wed, Jun 28, 2023 at 9:47 PM Damien Mattei <damien.mat...@gmail.com> wrote: > > thank you, ok , i understand ,my Scheme+ redefined <> to not = , this > was the problem, i apologize > > On Wed, Jun 28, 2023 at 5:27 PM Vivien Kraus <viv...@planete-kraus.eu> wrote: > > > > Le mercredi 28 juin 2023 à 17:10 +0200, Damien Mattei a écrit : > > > Vivien , your solution is not working: > > > > > > (let ((/ 42)) > > > (match (list 1 42) > > > ((c (? (cut equal? <> /))) > > > c))) > > > ;;; <stdin>:30:2: warning: wrong number of arguments to `#<tree-il > > > (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’t 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 (== /) (== /)) (displayln "T[/ /]")) > > > > This is not a self-contained example, I don’t know what is index*-or- > > keyword. Is it the division function or whatever is bound to / at that > > time? The / symbol? > > > > Vivien