Skip to content

Commit

Permalink
Always put binding clauses in separate lines
Browse files Browse the repository at this point in the history
Closes #58
  • Loading branch information
sorawee committed Aug 9, 2024
1 parent 6380419 commit 9740c16
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 180 deletions.
5 changes: 1 addition & 4 deletions conventions.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,7 @@
(try-indent
#:n 0
#:because-of xs
;; general case
(alt ((format-vertical/helper #:body-formatter (format-clause-2/indirect #:flat? #f)) xs)
;; try to fit in one line
((format-horizontal/helper #:body-formatter (format-clause-2/indirect #:flat? #f)) xs))))]
((format-vertical/helper #:body-formatter (format-clause-2/indirect #:flat? #f)) xs)))]
[_ (pretty doc)]))

(define-pretty format-define-args/indirect
Expand Down
107 changes: 74 additions & 33 deletions tests/benchmarks/class-internal.rkt.out

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions tests/benchmarks/hash.rkt.out
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
(if combine (lambda (_ x y) (combine x y)) (hash-duplicate-error 'hash-union!))]
one
. rest)
(for* ([two (in-list rest)] [(k v) (in-hash two)])
(for* ([two (in-list rest)]
[(k v) (in-hash two)])
(hash-set! one k (if (hash-has-key? one k) (combine/key k (hash-ref one k) v) v))))

(define (hash-intersect
Expand All @@ -41,7 +42,10 @@
(define hashes (cons one rest))
(define empty-h (hash-clear one)) ;; empty hash of same type as one
(define (argmin f lst) ;; avoid racket/list to improve loading time
(for/fold ([best (car lst)] [fbest (f (car lst))] #:result best) ([x (in-list lst)])
(for/fold ([best (car lst)]
[fbest (f (car lst))]
#:result best)
([x (in-list lst)])
(define fx (f x))
(if (< fx fbest) (values x fx) (values best fbest))))
(for/fold ([res empty-h]) ([k (in-hash-keys (argmin hash-count hashes))])
Expand Down
Loading

0 comments on commit 9740c16

Please sign in to comment.