File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 (define (rec ss fs)
3636 (match ss
3737 [(list s) fs]
38- [(cons (cons 'define sd) sr)
38+ [(cons (cons (? (not-in fs) 'define ) sd) sr)
3939 (match (parse-defn-name sd)
4040 [f (if (memq f fs)
4141 (error "duplicate definition " f)
Original file line number Diff line number Diff line change 5555 (Prog (list (Defn 'define '() (Lit 0 )))
5656 (App 'define '() )))
5757 (check-exn exn:fail? (λ () (parse '(define (f y y) y) 1 )))
58+ (check-exn exn:fail? (λ () (parse '(define (f y) y) '(define (f x) x) 1 )))
5859 (check-equal? (parse-closed '(define (f x) (g x))
5960 '(define (g x) (f x))
6061 '(f 0 ))
6162 (Prog (list (Defn 'f '(x) (App 'g (list (Var 'x ))))
6263 (Defn 'g '(x) (App 'f (list (Var 'x )))))
63- (App 'f (list (Lit 0 ))))))
64+ (App 'f (list (Lit 0 )))))
65+ (check-equal? (parse '(define (define x) x)
66+ '(define 1 ))
67+ (Prog (list (Defn 'define '(x) (Var 'x )))
68+ (App 'define (list (Lit 1 )))))
69+ (check-exn exn:fail? (λ () (parse '(define (define x) x)
70+ '(define (g x) x)
71+ '(define (g 1 ))))))
6472
Original file line number Diff line number Diff line change 3535 (define (rec ss fs)
3636 (match ss
3737 [(list s) fs]
38- [(cons (cons 'define sd) sr)
38+ [(cons (cons (? (not-in fs) 'define ) sd) sr)
3939 (match (parse-defn-name sd)
4040 [f (if (memq f fs)
4141 (error "duplicate definition " f)
Original file line number Diff line number Diff line change 4747 (check-equal? (parse "asdf " ) (p (Lit "asdf " )))
4848 (check-equal? (parse '(make-string 10 #\a ))
4949 (p (Prim2 'make-string (Lit 10 ) (Lit #\a )))))
50+
5051(begin ; Iniquity
5152 (check-equal? (parse '(define (f x) x) 1 )
5253 (Prog (list (Defn 'f '(x) (Var 'x ))) (Lit 1 )))
Original file line number Diff line number Diff line change 4141 (define (rec ss fs)
4242 (match ss
4343 [(list s) fs]
44- [(cons (cons 'define sd) sr)
44+ [(cons (cons (? (not-in fs) 'define ) sd) sr)
4545 (match (parse-defn-name sd)
4646 [f (if (memq f fs)
4747 (error "duplicate definition " f)
126126 (list ys gs (Let x e1 e2))])])]
127127 [_ (error "let: bad syntax " s)])]
128128 ['match
129- (match sr
130- [(cons s sr)
131- (match (rec s xs ys gs)
132- [(list ys gs e)
133- (match (parse-match-clauses/acc sr fs xs ys gs)
134- [(list ys gs ps es)
135- (list ys gs (Match e ps es))])])]
136- [_ (error "match: bad syntax " s)])]
129+ (match sr
130+ [(cons s sr)
131+ (match (rec s xs ys gs)
132+ [(list ys gs e)
133+ (match (parse-match-clauses/acc sr fs xs ys gs)
134+ [(list ys gs ps es)
135+ (list ys gs (Match e ps es))])])]
136+ [_ (error "match: bad syntax " s)])]
137137 [_
138138 (match (parse-es/acc sr fs xs ys gs)
139139 [(list ys gs es)
Original file line number Diff line number Diff line change 4747 (check-equal? (parse "asdf " ) (p (Lit "asdf " )))
4848 (check-equal? (parse '(make-string 10 #\a ))
4949 (p (Prim2 'make-string (Lit 10 ) (Lit #\a )))))
50+
5051(begin ; Iniquity
5152 (check-equal? (parse '(define (f x) x) 1 )
5253 (Prog (list (Defn 'f '(x) (Var 'x ))) (Lit 1 )))
Original file line number Diff line number Diff line change 4141 (define (rec ss fs)
4242 (match ss
4343 [(list s) fs]
44- [(cons (cons 'define sd) sr)
44+ [(cons (cons (? (not-in fs) 'define ) sd) sr)
4545 (match (parse-defn-name sd)
4646 [f (if (memq f fs)
4747 (error "duplicate definition " f)
116116 (list ys (Let x e1 e2))])])]
117117 [_ (error "let: bad syntax " s)])]
118118 ['match
119- (match sr
120- [(cons s sr)
121- (match (rec s xs ys)
122- [(list ys e)
123- (match (parse-match-clauses/acc sr xs ys)
124- [(list ys ps es)
125- (list ys (Match e ps es))])])]
126- [_ (error "match: bad syntax " s)])]
119+ (match sr
120+ [(cons s sr)
121+ (match (rec s xs ys)
122+ [(list ys e)
123+ (match (parse-match-clauses/acc sr xs ys)
124+ [(list ys ps es)
125+ (list ys (Match e ps es))])])]
126+ [_ (error "match: bad syntax " s)])]
127127
128128 [(or 'λ 'lambda )
129129 (match sr
Original file line number Diff line number Diff line change 4747 (check-equal? (parse "asdf " ) (p (Lit "asdf " )))
4848 (check-equal? (parse '(make-string 10 #\a ))
4949 (p (Prim2 'make-string (Lit 10 ) (Lit #\a )))))
50+
5051(begin ; Iniquity
5152 (check-equal? (parse '(define (f x) x) 1 )
5253 (Prog (list (Defn 'f '(x) (Var 'x ))) (Lit 1 )))
You can’t perform that action at this time.
0 commit comments