Skip to content

Commit 60a7426

Browse files
Fix 2 occurrences of if-let-to-cond
`cond` with internal definitions is preferred over `if` with `let`, to reduce nesting
1 parent 91e9329 commit 60a7426

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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)

0 commit comments

Comments
 (0)