From a0bf7d0039f3b869f1b19d33d58192b6bbc3e817 Mon Sep 17 00:00:00 2001 From: haskal Date: Thu, 17 Dec 2020 00:59:45 -0500 Subject: [PATCH] day 17: minor despaghetti --- 17.rkt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/17.rkt b/17.rkt index d2f2a19..164e16f 100644 --- a/17.rkt +++ b/17.rkt @@ -6,6 +6,7 @@ (struct pt [x y z w] #:transparent) (define pt-getters (list pt-x pt-y pt-z pt-w)) +(define origin (pt 0 0 0 0)) (define (pt+ . args) (for/fold ([ans (pt 0 0 0 0)]) ([x (in-list args)]) @@ -21,13 +22,7 @@ (pt x y z w))) (define nearby/4d - (for*/list ([x (in-range -1 2)] - [y (in-range -1 2)] - [z (in-range -1 2)] - [w (in-range -1 2)] - #:unless (and (zero? x) (zero? y) (zero? z) (zero? w))) - (pt x y z w))) - + (for/list ([pt (in-pts origin origin #t)] #:unless (equal? pt origin)) pt)) (define nearby/3d (filter #{zero? (pt-w %)} nearby/4d)) (define (calc-bounds world)