From cd71170ff9d17b1c6065e4c09884fb4cb63176bf Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 5 Jan 2019 17:45:50 -0800 Subject: [PATCH] delete unneeded cache --- quad/quad/break.rkt | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/quad/quad/break.rkt b/quad/quad/break.rkt index eed9b763..15440533 100644 --- a/quad/quad/break.rkt +++ b/quad/quad/break.rkt @@ -7,22 +7,13 @@ [(_ EXPR ...) (with-syntax ([debug (datum->syntax stx 'debug)]) #'(when debug (report EXPR ...)))])) -(define distance-cache (make-hasheq)) (define (distance q) - (hash-ref! distance-cache (cond - [(quad? q) - (hash-ref (quad-attrs q) 'id q)] - [(symbol? q) q]) - (λ () - (cond - [(quad? q) - (match-define (list ∆x ∆y) (map - (out-point q) (in-point q))) - (cond - [(zero? ∆x) ∆y] - [(zero? ∆y) ∆x] - [else (sqrt (+ (* ∆x ∆x) (* ∆y ∆y)))])] - [else 0])))) - + (if (quad? q) + (match (pt- (out-point q) (in-point q)) + [(list (? zero?) ∆y) ∆y] + [(list ∆x (? zero?)) ∆x] + [(list ∆x ∆y) (sqrt (+ (* ∆x ∆x) (* ∆y ∆y)))]) + 0)) (define+provide/contract (break xs [target-size (current-wrap-distance)]