Same ⟨pattern variable⟩ apparing two or more times Amirouche (26 Dec 2022 11:44 UTC)
Re: Same ⟨pattern variable⟩ apparing two or more times Marc Nieper-Wißkirchen (26 Dec 2022 12:47 UTC)
Re: Same ⟨pattern variable⟩ apparing two or more times Amirouche (26 Dec 2022 15:48 UTC)
Re: Same ⟨pattern variable⟩ apparing two or more times Marc Nieper-Wißkirchen (26 Dec 2022 16:12 UTC)

Re: Same ⟨pattern variable⟩ apparing two or more times Amirouche 26 Dec 2022 15:48 UTC

> (match '(42 42 nothing)
> ((,a1 ,a2 . rest) (guard (= a1 a2)) a1))
>
> This also circumvents the problem of which equivalence predicate to choose.
>
> PS A cata variable can coincide with a pattern variable, but not with
> another cata variable.

I am uncertain if I understand. What the following yields:

 (match '(a (a))
  ((,a . ,(a)) a)
  (() '()))

Will the cata variable shadow the pattern variable?