Feature request: Customize equality predicate for pattern variables Marc Nieper-Wißkirchen (05 Sep 2020 15:20 UTC)
Re: Feature request: Customize equality predicate for pattern variables Marc Nieper-Wißkirchen (13 Sep 2020 13:08 UTC)
Re: Feature request: Customize equality predicate for pattern variables Marc Nieper-Wißkirchen (13 Sep 2020 13:55 UTC)
(missing)
(missing)

Re: Feature request: Customize equality predicate for pattern variables Marc Nieper-Wißkirchen 13 Sep 2020 13:08 UTC

Felix, thanks for this suggestion. It's a good one if pattern
variables are bound early and in the lexical tree order of the
pattern.

When they are not (and I still believe that this is the much simpler,
clearer, and a lot better optimizable semantics), it doesn't work,
though. What would you think of adding a special pattern clause that
declares an equivalence predicate for pattern variables? E.g. as
follows:

(match (<pat> . <body>) ...)

is replaced by

(match (<top-pat> . <body>) ...)

and <top-pat> is either <pat> or  (<decl> <pat>)

where <decl> is some meta-information (extensible), which can include
declare equivalence predicates for certain pattern variables.

This meta-information can also be used to restrict (or extend) the
number of special identifiers to make the match pattern language
future-proof.