Skip to content

Commit 6dc1508

Browse files
committed
fmt, AGENTS.md twekas
1 parent 3e6e477 commit 6dc1508

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ herbie-compiled/
2626

2727
# Python
2828
.env/
29+
.worktrees

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

22
# Testing
33

4-
- Run `make fmt` to format the code before presentingcode. This is
4+
- Run `make fmt` to format the code before finishing a task. This is
55
mandatory and PRs that don't follow the coding style are rejected.
6+
- Always check your `git diff` before finishing a task. There's often
7+
leftover or dead code, and you should delete it.
68
- Run `racket src/main.rkt report bench/tutorial.fpcore tmp` to test
79
that your changes work; this should take about 5-10 seconds and all
810
of the tests should pass, getting basically perfect accuracy.

src/core/egg-herbie.rkt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -529,21 +529,20 @@
529529
;; Synthesizes lowering rules for a given platform.
530530
(define (platform-lowering-rules [pform (*active-platform*)])
531531
(define impls (platform-impls pform))
532-
(append* (for/list ([impl (in-list impls)])
533-
(hash-ref! (*lowering-rules*)
534-
(cons impl pform)
535-
(lambda ()
536-
(define name (sym-append 'lower- impl))
537-
(define-values (vars spec-expr impl-expr) (impl->rule-parts impl))
538-
(list (rule name spec-expr impl-expr '(lowering))
539-
(rule (sym-append 'lower-unsound- impl)
540-
(add-unsound spec-expr)
541-
impl-expr
542-
'(lowering))
543-
(rule (sym-append 'lower-sound- impl)
544-
(add-sound-with-wildcard spec-expr)
545-
impl-expr
546-
'(lowering))))))))
532+
(append*
533+
(for/list ([impl (in-list impls)])
534+
(hash-ref!
535+
(*lowering-rules*)
536+
(cons impl pform)
537+
(lambda ()
538+
(define name (sym-append 'lower- impl))
539+
(define-values (vars spec-expr impl-expr) (impl->rule-parts impl))
540+
(list (rule name spec-expr impl-expr '(lowering))
541+
(rule (sym-append 'lower-unsound- impl) (add-unsound spec-expr) impl-expr '(lowering))
542+
(rule (sym-append 'lower-sound- impl)
543+
(add-sound-with-wildcard spec-expr)
544+
impl-expr
545+
'(lowering))))))))
547546

548547
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
549548
;; Racket egraph

src/core/rules.rkt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
(define (add-sound-with-wildcard expr)
4141
(match expr
4242
[(list op args ...)
43-
(cons (sym-append "sound-" op)
44-
(append (map add-sound-with-wildcard args) (list '_)))]
43+
(cons (sym-append "sound-" op) (append (map add-sound-with-wildcard args) (list '_)))]
4544
[_ expr]))
4645

4746
(define-syntax define-rule

0 commit comments

Comments
 (0)