File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333;; | 'vector? | vector-length
3434;; | 'string? | string-length
3535;; type Op2 = '+ | '- | '< | '=
36- ;; | 'cons
36+ ;; | 'cons | 'eq?
3737;; | 'make-vector | 'vector-ref
3838;; | 'make-string | 'string-ref
3939;; type Op3 = 'vector-set!
Original file line number Diff line number Diff line change 3636 [(Eof) eof]
3737 [(Empty) '() ]
3838 [(Var x) (lookup r x)]
39- [(Str s) (string-copy s) ]
39+ [(Str s) s ]
4040 [(Prim0 'void ) (void)]
4141 [(Prim0 'read-byte ) (read-byte)]
4242 [(Prim0 'peek-byte ) (peek-byte)]
Original file line number Diff line number Diff line change 7272 [(list 'cons p1 p2)
7373 (PCons (parse-pat p1) (parse-pat p2))]
7474 [(list 'and p1 p2)
75- (PAnd (parse-pat p1) (parse-pat p2))]
76- [(list 'list )
77- (PLit '() )]
78- [(cons 'list (cons p ps))
79- (PCons (parse-pat p) (parse-pat (cons 'list ps)))]))
75+ (PAnd (parse-pat p1) (parse-pat p2))]))
8076
8177(define op0
8278 '(read-byte peek-byte void))
Original file line number Diff line number Diff line change 231231 (check-equal? (run '(match (box 1 ) [(box 2 ) 0 ] [_ 1 ]))
232232 1 )
233233 (check-equal? (run '(match (box 1 ) [(box x) x] [_ 2 ]))
234- 1 )
235- (check-equal? (run '(match '() [(list) 1 ] [_ 2 ]))
236- 1 )
237- (check-equal? (run '(match '() [(list 1 ) 1 ] [_ 2 ]))
238- 2 )
239- (check-equal? (run '(match (cons 1 '() ) [(list 1 ) 1 ] [_ 2 ]))
240- 1 )
241- (check-equal? (run '(match (cons 1 (cons 2 (cons 3 '() ))) [(list x y z) z] [_ 2 ]))
242- 3 ))
234+ 1 ))
243235
244236(define (test-runner-io run)
245237 ;; Evildoer examples
You can’t perform that action at this time.
0 commit comments