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)