Skip to content

Commit d299565

Browse files
authored
Crook (#1)
Fix bug in predicate match pattern.
1 parent 7d0a484 commit d299565

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

knock-plus/interp.rkt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
[(Defn f (list x) e)
136136
(match (interp-env e (list (list x v)) ds)
137137
['err 'err]
138+
[#f #f]
138139
[v r])]
139140
[_ 'err])]
140141
[(Vect ps)

knock-plus/test/test-runner.rkt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,27 @@
259259
(check-equal? (run '(match (vector 1 2 3)
260260
[(list x y z) #f]
261261
[_ #t]))
262-
#t)))
262+
#t)
263+
(check-equal? (run '(define (never? x) #f)
264+
'(match #t
265+
[(? never?) 1]
266+
[_ 2]))
267+
2)
268+
(check-equal? (run '(define (always? x) #t)
269+
'(match #f
270+
[(? always?) 1]
271+
[_ 2]))
272+
1)
273+
(check-equal? (run '(define (id x) x)
274+
'(match #t
275+
[(and (? id) y) y]
276+
[_ 2]))
277+
#t)
278+
(check-equal? (run '(define (id x) x)
279+
'(match #f
280+
[(and (? id) y) y]
281+
[_ 2]))
282+
2)))
263283

264284
(define (test/io run)
265285
(begin ;; Evildoer

0 commit comments

Comments
 (0)