Open fthibault1969 opened 4 years ago
Using the same library definition as gerbil
looks like it works.
FYI, Foment allows you to mix library definitions and then code that imports and uses the library definition in the same file.
(define-library (srfi-204)
(export match match-lambda match-lambda* match-let match-letrec match-let*
___ **1 =.. *.. *** ? $ struct object get!)
(import (scheme base))
(include "../../srfi-204/srfi/auxiliary-syntax.scm")
(begin
(define-auxiliary-keywords ___ **1 =.. *.. *** ? $ struct object get!))
(include "../../srfi-204/srfi/srfi-204/srfi-204.scm"))
(import (foment base))
(import (srfi-204))
(write (match 2 (1 #t) (2 #f))) (newline)
(write (match '(1 2 2) ((1 2 ...) 2))) (newline)
(write (match '(1 2 2) ((a b ...) b))) (newline)
#f
2
(2 2)
The pattern matcher works on patterns that are only literals like: (match 2 (1 #t) (2 #f))
(match '(1 2 2) ((1 2 ...) 2))
but patterns with variables like:
(match '(1 2 2) ((a b ...) b))
crash with "assert IdentifierP(obj) (190)../src/synrules.cpp" and then a long column of numbers.