aboutsummaryrefslogtreecommitdiff
path: root/2015/day-03/day-03.rkt
diff options
context:
space:
mode:
authorJ.J <thechairman@thechairman.info>2023-11-30 17:10:00 -0500
committerJ.J <thechairman@thechairman.info>2023-11-30 17:10:00 -0500
commit8ab65dc2da1742eb86ec636c50c7018385b68167 (patch)
treec4fd556aca9b867cfa1f2f174128c30857353884 /2015/day-03/day-03.rkt
parentfafbeaf9e3c09ba7a5bea7e47d5736001f8a5aa1 (diff)
downloadgleam_aoc-8ab65dc2da1742eb86ec636c50c7018385b68167.tar.gz
gleam_aoc-8ab65dc2da1742eb86ec636c50c7018385b68167.zip
prep for 2023, renaming for consistency
Diffstat (limited to '2015/day-03/day-03.rkt')
-rw-r--r--2015/day-03/day-03.rkt28
1 files changed, 0 insertions, 28 deletions
diff --git a/2015/day-03/day-03.rkt b/2015/day-03/day-03.rkt
deleted file mode 100644
index 1d44955..0000000
--- a/2015/day-03/day-03.rkt
+++ /dev/null
@@ -1,28 +0,0 @@
-#lang racket
-(require "../../jj-aoc.rkt"
- threading
- (only-in algorithms chunks-of)
- racket/hash)
-
-(define directions
- (for/list ([l (in-input-port-chars (open-day 3 2015))])
- (string->symbol (string l))))
-
-(define (trace-santa dirs)
- (define visits (make-hash))
- (for/fold ([x 0] [y 0] #:result visits) ([dir (in-list dirs)])
- (hash-set! visits `(,x ,y) #true)
- (match dir
- ['^ (values x (add1 y))]
- ['v (values x (sub1 y))]
- ['< (values (add1 x) y)]
- ['> (values (sub1 x) y)])))
-
-;; part 1
-(~> directions trace-santa hash-values length)
-
-;; part 2
-(~> directions (chunks-of 2) (apply map list _) (map trace-santa _) (match-define (list real robo) _))
-
-(hash-union! real robo #:combine (λ _ #true))
-(~> real hash-values length)