From 7d2141ae563d10d9dd7e1e7e5de54919ed6c3226 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 13 Feb 2020 18:08:02 -0800 Subject: [PATCH] Revert "mutational flatten" This reverts commit d1e81308d6caf0cfc755b46fb92bd074ce80071d. --- quad/quad/position.rkt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/quad/quad/position.rkt b/quad/quad/position.rkt index a86d5bcd..8ce69aa1 100644 --- a/quad/quad/position.rkt +++ b/quad/quad/position.rkt @@ -128,9 +128,8 @@ [(list ∆x ∆y) (sqrt (+ (expt ∆x 2) (expt ∆y 2)))])) (define (flatten-quad q) - (define elems (quad-elems q)) - (cons (quad-update! q [elems null]) - (apply append (map flatten-quad elems)))) + (cons (struct-copy quad q [elems null]) + (apply append (map flatten-quad (quad-elems q))))) (define (bounding-box . qs-in) ;; size of box that holds q and all subqs, based on reported origin and size