Skip to content

Commit 6bee7b8

Browse files
authored
Merge pull request #1283 from herbie-fp/codex/simplify-find-preprocessing-function
Refactor preprocessing search
2 parents 73ab1ec + f01e634 commit 6bee7b8

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/core/preprocess.rkt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
(define spec (prog->spec expr))
6565

6666
;; identities
67-
(define even-identities (make-even-identities spec ctx))
68-
(define odd-identities (make-odd-identities spec ctx))
69-
(define sort-identities (make-sort-identities spec ctx))
70-
(define identities (append even-identities odd-identities sort-identities))
67+
(define identities
68+
(append (make-even-identities spec ctx)
69+
(make-odd-identities spec ctx)
70+
(make-sort-identities spec ctx)))
7171

7272
;; make egg runner
7373
(define rules (*sound-rules*))
@@ -80,21 +80,9 @@
8080
`((,rules . ((node . ,(*node-limit*)))))))
8181

8282
;; collect equalities
83-
(define abs-instrs
84-
(for/list ([(ident spec*) (in-dict even-identities)]
85-
#:when (egraph-equal? runner spec spec*))
86-
ident))
87-
88-
(define negabs-instrs
89-
(for/list ([(ident spec*) (in-dict odd-identities)]
90-
#:when (egraph-equal? runner spec spec*))
91-
ident))
92-
93-
(define sort-instrs
94-
(for/list ([(ident spec*) (in-dict sort-identities)]
95-
#:when (egraph-equal? runner spec spec*))
96-
ident))
97-
(append abs-instrs negabs-instrs sort-instrs))
83+
(for/list ([(ident spec*) (in-dict identities)]
84+
#:when (egraph-equal? runner spec spec*))
85+
ident))
9886

9987
(define (preprocess-pcontext context pcontext preprocessing)
10088
(define preprocess

0 commit comments

Comments
 (0)