Qupak: Pattern Matching for Prolog with library(reif)
11 hours ago
- #Reification
- #Pattern Matching
- #Prolog
- The library provides predicates for pattern matching, expanding on library(reif).
- Core predicate is pattern_match_t/3, with a non-reified version pattern_match/2.
- Operators like (=~)/3 are provided for ergonomic pattern matching.
- Patterns can match ground terms, bind variables, or perform reified unification.
- Special patterns include (*) for ignoring terms and (<<) for binding whole patterns.
- Reified predicates can be used to further constrain matches.
- The match/2 predicate implements a switch-like statement using pattern matching.
- Example usage demonstrates matching terms and handling dif/2 constraints.