aboutsummaryrefslogtreecommitdiffstats
path: root/csc/match.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-07-03 14:37:10 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-07-03 14:37:10 -0700
commitbcb098e8eb18637b6999789585a38ff9168de9d5 (patch)
treefe2bee9fcc5cac8c2f8362c836901f7a3643cb03 /csc/match.csc
parentWrite closure conversion. (diff)
downloadchromatopelma-bcb098e8eb18637b6999789585a38ff9168de9d5.tar.zst
Add a diff library.
I was hesitant to add a diff library, but it was surprisingly easy. A straightforward application of dynamic programming.
Diffstat (limited to 'csc/match.csc')
-rw-r--r--csc/match.csc4
1 files changed, 2 insertions, 2 deletions
diff --git a/csc/match.csc b/csc/match.csc
index ad9b56a..f6ed477 100644
--- a/csc/match.csc
+++ b/csc/match.csc
@@ -25,7 +25,7 @@
(define (matcher x)
(unless (predicate x)
(raise *no-match*))
- (list (field-getter* x) ...))))))
+ (list (cons 'type 'name) (cons 'field-name* (field-getter* x)) ...))))))
(define-syntax match-pattern
@@ -51,7 +51,7 @@
(match-pattern (car y) pattern result result* ...)
(raise *no-match*))))
((match-pattern x (% record-matcher . patterns) result result* ...)
- (match-pattern (record-matcher x) patterns result result* ...))
+ (match-pattern (map cdr (cdr (record-matcher x))) patterns result result* ...))
((match-pattern x (pattern . rest) result result* ...)
(let ((y x))
(if (pair? y)