fixing named match-let

This commit is contained in:
Alex Shinn 2016-03-06 22:54:28 +09:00
parent 45c03c5dcb
commit 6fe952e108
2 changed files with 10 additions and 1 deletions

View file

@ -186,6 +186,14 @@
(((and x (? symbol?)) ..1) x)
(else #f)))
(test "match-named-let" 6
(match-let loop (((x . rest) '(1 2 3))
(sum 0))
(let ((sum (+ x sum)))
(if (null? rest)
sum
(loop rest sum)))))
(cond-expand
(chibi
(test "record positional"

View file

@ -227,6 +227,7 @@
;; performance can be found at
;; http://synthcode.com/scheme/match-cond-expand.scm
;;
;; 2016/03/06 - fixing named match-let (thanks to Stefan Israelsson Tampe)
;; 2015/05/09 - fixing bug in var extraction of quasiquote patterns
;; 2014/11/24 - adding Gauche's `@' pattern for named record field matching
;; 2012/12/26 - wrapping match-let&co body in lexical closure
@ -856,7 +857,7 @@
((_ ((var value) ...) . body)
(match-let/helper let () () ((var value) ...) . body))
((_ loop ((var init) ...) . body)
(match-named-let loop ((var init) ...) . body))))
(match-named-let loop () ((var init) ...) . body))))
;;> Similar to \scheme{match-let}, but analogously to \scheme{letrec}
;;> matches and binds the variables with all match variables in scope.