mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
fixing named match-let
This commit is contained in:
parent
45c03c5dcb
commit
6fe952e108
2 changed files with 10 additions and 1 deletions
|
@ -186,6 +186,14 @@
|
||||||
(((and x (? symbol?)) ..1) x)
|
(((and x (? symbol?)) ..1) x)
|
||||||
(else #f)))
|
(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
|
(cond-expand
|
||||||
(chibi
|
(chibi
|
||||||
(test "record positional"
|
(test "record positional"
|
||||||
|
|
|
@ -227,6 +227,7 @@
|
||||||
;; performance can be found at
|
;; performance can be found at
|
||||||
;; http://synthcode.com/scheme/match-cond-expand.scm
|
;; 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
|
;; 2015/05/09 - fixing bug in var extraction of quasiquote patterns
|
||||||
;; 2014/11/24 - adding Gauche's `@' pattern for named record field matching
|
;; 2014/11/24 - adding Gauche's `@' pattern for named record field matching
|
||||||
;; 2012/12/26 - wrapping match-let&co body in lexical closure
|
;; 2012/12/26 - wrapping match-let&co body in lexical closure
|
||||||
|
@ -856,7 +857,7 @@
|
||||||
((_ ((var value) ...) . body)
|
((_ ((var value) ...) . body)
|
||||||
(match-let/helper let () () ((var value) ...) . body))
|
(match-let/helper let () () ((var value) ...) . body))
|
||||||
((_ loop ((var init) ...) . 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}
|
;;> Similar to \scheme{match-let}, but analogously to \scheme{letrec}
|
||||||
;;> matches and binds the variables with all match variables in scope.
|
;;> matches and binds the variables with all match variables in scope.
|
||||||
|
|
Loading…
Add table
Reference in a new issue