Skip to content

Commit d297d7f

Browse files
committed
simplification of preprocess.rkt
1 parent 06a8bd5 commit d297d7f

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/core/mainloop.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
;; extracts the base expressions of a patch as a batchref
225225
(define (get-starting-expr altn)
226226
(match* ((alt-event altn) (alt-prevs altn))
227-
[((list 'patch expr _) _) expr] ; here original Expr can be pulled as well
227+
[((list 'patch expr _) _) expr]
228228
[(_ (list prev)) (get-starting-expr prev)]
229229
[(_ _) (error 'get-starting-spec "unexpected: ~a" altn)]))
230230

src/core/preprocess.rkt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,15 @@
7272

7373
; run egg
7474
(define simplified
75-
(map debatchref
76-
(simplify-batch runner
77-
(typed-egg-batch-extractor
78-
(if (*egraph-platform-cost*) platform-egg-cost-proc default-egg-cost-proc)
79-
batch))))
75+
(debatchref (car (simplify-batch runner
76+
(typed-egg-batch-extractor (if (*egraph-platform-cost*)
77+
platform-egg-cost-proc
78+
default-egg-cost-proc)
79+
batch)))))
8080

8181
; alternatives
8282
(define start-alt (make-alt expr))
83-
(cons start-alt
84-
(remove-duplicates (for/list ([expr simplified])
85-
(alt expr `(simplify () ,runner #f #f) (list start-alt) '()))
86-
alt-equal?)))
83+
(cons start-alt (list (alt simplified `(simplify () ,runner #f #f) (list start-alt) '()))))
8784

8885
;; See https://pavpanchekha.com/blog/symmetric-expressions.html
8986
(define (find-preprocessing init expr ctx)

0 commit comments

Comments
 (0)