SRFI 257: Simple extendable pattern matcher with backtracking

by Sergei Egorov

status: draft (2024-12-29)

keywords: Pattern Matching

See also SRFI 200: Pattern Matching, SRFI 204: Wright-Cartwright-Shinn Pattern Matcher, SRFI 241: Match — Simple Pattern-Matching Syntax to Express Catamorphisms on Scheme Data, and SRFI 262: Extensible pattern matcher.

Abstract

Pattern matching extends Scheme's repertoire of conditional constructs, allowing decomposition of compound data structures and binding their parts to variables. This SRFI proposes one such construct, match, which offers all the core functionality specified in SRFI 200, while extending it with support for non-linear patterns and backtracking. The proposed construct is modular and supports easy extension through the define-match-pattern mechanism. It can be implemented portably in R⁷RS-Small.