Skip to content

Commit 7df6f5f

Browse files
authored
Merge pull request #1408 from herbie-fp/autofix-52-1
Automated Resyntax fixes
2 parents 235c62d + 60a7426 commit 7df6f5f

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

src/core/explain.rkt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@
153153

154154
(cond
155155
[(> (- x.eps y.eps) 100) (silence y-ex)]
156-
[(> (- y.eps x.eps) 100) (silence x-ex)])
156+
[(> (- y.eps x.eps) 100) (silence x-ex)]
157+
[else (void)])
157158

158159
(cond
159160
; Condition number hallucination
@@ -198,7 +199,8 @@
198199

199200
(cond
200201
[(> (- x.eps y.eps) 100) (silence y-ex)]
201-
[(> (- y.eps x.eps) 100) (silence x-ex)])
202+
[(> (- y.eps x.eps) 100) (silence x-ex)]
203+
[else (void)])
202204

203205
(cond
204206
; Condition number hallucination:
@@ -530,7 +532,7 @@
530532

531533
(define explanations-table
532534
(for/list ([(key val) (in-dict expls->points)]
533-
#:unless (zero? (length val)))
535+
#:unless (empty? val))
534536
(define subexpr (car key))
535537
(define expl (cdr key))
536538
(define err-count (length val))
@@ -582,7 +584,7 @@
582584

583585
(define points->expl (make-hash))
584586

585-
(for* ([(_ points) (in-dict expls->points)]
587+
(for* ([points (in-dict-values expls->points)]
586588
[pt (in-list points)])
587589
(hash-update! points->expl pt add1 0))
588590

src/core/patch.rkt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@
9696
(define reprs (map (batch-reprs global-batch (*context*)) brfs))
9797

9898
(define runner
99-
(if (flag-set? 'generate 'egglog)
100-
(let-values ([(batch* brfs*) (batch-copy-only global-batch brfs)])
101-
(make-egglog-runner batch* brfs* reprs schedule (*context*)))
102-
(make-egraph global-batch brfs reprs schedule (*context*))))
99+
(cond
100+
[(flag-set? 'generate 'egglog)
101+
(define-values (batch* brfs*) (batch-copy-only global-batch brfs))
102+
(make-egglog-runner batch* brfs* reprs schedule (*context*))]
103+
[else (make-egraph global-batch brfs reprs schedule (*context*))]))
103104

104105
(define batchrefss
105106
(if (flag-set? 'generate 'egglog)
@@ -168,10 +169,11 @@
168169
(define reprs (map (batch-reprs global-batch (*context*)) brfs))
169170

170171
(define runner
171-
(if (flag-set? 'generate 'egglog)
172-
(let-values ([(batch* brfs*) (batch-copy-only global-batch brfs)])
173-
(make-egglog-runner batch* brfs* reprs schedule (*context*)))
174-
(make-egraph global-batch brfs reprs schedule (*context*))))
172+
(cond
173+
[(flag-set? 'generate 'egglog)
174+
(define-values (batch* brfs*) (batch-copy-only global-batch brfs))
175+
(make-egglog-runner batch* brfs* reprs schedule (*context*))]
176+
[else (make-egraph global-batch brfs reprs schedule (*context*))]))
175177

176178
(define batchrefss
177179
(if (flag-set? 'generate 'egglog)

src/core/rival.rkt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@
3232
(listof any/c))]))
3333

3434
(define (unified-contexts? ctxs)
35-
(and ((non-empty-listof context?) ctxs)
36-
(let ([ctx0 (car ctxs)])
37-
(for/and ([ctx (in-list (cdr ctxs))])
38-
(and (equal? (context-vars ctx0) (context-vars ctx))
39-
(for/and ([var (in-list (context-vars ctx0))])
40-
(equal? (context-lookup ctx0 var) (context-lookup ctx var))))))))
35+
(cond
36+
[((non-empty-listof context?) ctxs)
37+
(define ctx0 (car ctxs))
38+
(for/and ([ctx (in-list (cdr ctxs))])
39+
(and (equal? (context-vars ctx0) (context-vars ctx))
40+
(for/and ([var (in-list (context-vars ctx0))])
41+
(equal? (context-lookup ctx0 var) (context-lookup ctx var)))))]
42+
[else #f]))
4143

4244
(define (expr-size expr)
4345
(if (list? expr)

0 commit comments

Comments
 (0)