diff --git a/patterns.scm b/patterns.scm index d6a56ed..1b0b40d 100644 --- a/patterns.scm +++ b/patterns.scm @@ -71,9 +71,9 @@ (define (dict:value vcell) (interpret-segment (cadr vcell))) -(define (dictionary->entry-list dict) +(define (dictionary->alist dict) (map (lambda (entry) - (list (car entry) (interpret-segment (cadr entry)))) + (cons (car entry) (interpret-segment (cadr entry)))) dict)) ;;; Segment variables introduce some additional trouble. Unlike other @@ -264,7 +264,7 @@ (matcher datum '() (lambda (dict) - (dictionary->entry-list dict))))) + (dictionary->alist dict))))) (define (for-each-matcher pattern) (for-each-dictionary (match:->combinators pattern))) @@ -274,7 +274,7 @@ (matcher datum '() (lambda (dict) - (f (dictionary->entry-list dict)) + (f (dictionary->alist dict)) #f)))) (define (all-results-matcher pattern) diff --git a/test/patterns-test.scm b/test/patterns-test.scm index 8776d09..01b7ad8 100644 --- a/test/patterns-test.scm +++ b/test/patterns-test.scm @@ -46,10 +46,10 @@ (lambda (x) `(succeed ,x)))) (equal? - '(((y (b b b b b b)) (x ())) - ((y (b b b b)) (x (b))) - ((y (b b)) (x (b b))) - ((y ()) (x (b b b)))) + '(((y . (b b b b b b)) (x . ())) + ((y . (b b b b)) (x . (b))) + ((y . (b b)) (x . (b b))) + ((y . ()) (x . (b b b)))) ((all-dictionaries (match:->combinators '(a (?? x) (?? y) (?? x) c))) '(a b b b b b b c))) @@ -58,7 +58,7 @@ '(a b b b b b b a))) (equal? - '((b 1)) + '((b . 1)) ((matcher '(a ((? b) 2 3) (? b) c)) '(a (1 2 3) 1 c)))) @@ -85,7 +85,7 @@ (match:->combinators '(and (?? stuff)))) (let ((items (iota 10))) ; constant time, except building the test list (assert-equal - `(((stuff ,items))) + `(((stuff . ,items))) ((all-dictionaries matcher) `(and ,@items))))) )