Added pattern matching

ref variables now do pattern matching. This means that, say, the
variable binding the (car cursor) in (in-list ...) can be a (ice-9 match) pattern:

(loop/list (((a . b) (in-list '((1 ignore) (2 ignore) (3 ignore))))
  a)
;; => (1 2 3)
This commit is contained in:
Linus 2020-12-02 21:17:42 +01:00
parent 093d1319d9
commit 2dc4a72790

View file

@ -38,7 +38,8 @@
((srfi srfi-1) #:select (circular-list)) ((srfi srfi-1) #:select (circular-list))
(srfi srfi-71) (srfi srfi-71)
(rnrs io simple) (rnrs io simple)
(ice-9 futures)) (ice-9 futures)
(ice-9 match))
(define-aux-syntaxes (define-aux-syntaxes
;; Auxiliary syntax for the loop clauses ;; Auxiliary syntax for the loop clauses
@ -297,7 +298,7 @@
(begin (begin
ff-cur ... ff-cur ...
(final-fun final-value ...)) (final-fun final-value ...))
(let (refs ...) (match-let (refs ...)
(user-let () () (user-lets ...) (user-let () () (user-lets ...)
(if (and user-whens ...) (if (and user-whens ...)
(let-kw-form name (let-kw-form name
@ -338,7 +339,7 @@
(begin (begin
ff-cur ... ff-cur ...
(final-fun final-value ...)) (final-fun final-value ...))
(let (refs ...) (match-let (refs ...)
(user-let () () (user-lets ...) (user-let () () (user-lets ...)
(if (and user-whens ...) (if (and user-whens ...)
(cond (cond
@ -388,7 +389,7 @@
(begin (begin
ff-cur ... ff-cur ...
outer) outer)
(let (refs ...) (match-let (refs ...)
(user-let () () (user-lets ...) (user-let () () (user-lets ...)
(if (and user-whens ...) (if (and user-whens ...)
(cond (cond
@ -423,7 +424,7 @@
(begin (begin
ff-cur ... ff-cur ...
outer) outer)
(let (refs ...) (match-let (refs ...)
(user-let () () (user-lets ...) (user-let () () (user-lets ...)
(if (and user-whens ...) (if (and user-whens ...)
(cond (cond