Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Inverse Rules #1016

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions infra/ci.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
(append-map load-tests bench-dirs)))
(define seed (pseudo-random-generator->vector (current-pseudo-random-generator)))
(printf "Running Herbie on ~a tests, seed: ~a\n" (length tests) seed)
(for/and ([the-test tests]
[i (in-naturals)])
(for/and ([the-test tests] [i (in-naturals)])
(printf "~a/~a\t" (~a (+ 1 i) #:width 3 #:align 'right) (length tests))
(define the-test*
(if (*precision*)
Expand Down
4 changes: 2 additions & 2 deletions src/core/mainloop.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
(define localized-exprs empty)
(define repr (context-repr (*context*)))

(when (flag-set? 'localize 'costs)
#| (when (flag-set? 'localize 'costs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you disable this?

(define loc-costss (batch-localize-costs exprs (*context*)))
(define cost-localized
(for/list ([loc-costs (in-list loc-costss)]
Expand All @@ -186,7 +186,7 @@
[_ (in-range (*localize-expressions-limit*))])
(timeline-push! 'locations (~a expr) "cost-diff" cost-diff)
expr))
(set! localized-exprs (remove-duplicates (append localized-exprs cost-localized))))
(set! localized-exprs (remove-duplicates (append localized-exprs cost-localized)))) |#

(timeline-event! 'localize)
(when (flag-set? 'localize 'errors)
Expand Down
9 changes: 3 additions & 6 deletions src/core/programs.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@
[(< len-a len-b) -1]
[(> len-a len-b) 1]
[else
(let loop ([a a]
[b b])
(let loop ([a a] [b b])
(if (null? a)
0
(let ([cmp (expr-cmp (car a) (car b))])
Expand Down Expand Up @@ -166,8 +165,7 @@
(define (invalid! where loc)
(error 'location-do "invalid location `~a` for `~a` in `~a`" loc where prog))

(let loop ([prog prog]
[loc loc])
(let loop ([prog prog] [loc loc])
Comment on lines -169 to +168
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You gotta update your raco fmt version. Run raco pkg update fmt.

(match* (prog loc)
[(_ (? null?)) (f prog)]
[((or (? literal?) (? number?) (? symbol?)) _) (invalid! prog loc)]
Expand All @@ -177,8 +175,7 @@
[(2) (approx spec (loop impl rest))]
[else (invalid! prog loc)])]
[((list op args ...) (cons idx rest)) ; operator
(let seek ([elts (cons op args)]
[idx idx])
(let seek ([elts (cons op args)] [idx idx])
(cond
[(= idx 0) (cons (loop (car elts) rest) (cdr elts))]
[(null? elts) (invalid! prog loc)]
Expand Down
Loading
Loading