diff options
author | H.J <thechairman@thechairman.info> | 2024-10-09 11:36:55 -0400 |
---|---|---|
committer | H.J <thechairman@thechairman.info> | 2024-10-09 11:36:55 -0400 |
commit | 8777ff071f7bb37631baa7b6717ad29961e50911 (patch) | |
tree | 6d59c4ed58e454b960339c3d1151f0a879e8d7cb /aoc2015/day-03 | |
parent | 6156a9ef7be4012063a042aafb4e9b0d7eadde8e (diff) | |
download | gleam_aoc-8777ff071f7bb37631baa7b6717ad29961e50911.tar.gz gleam_aoc-8777ff071f7bb37631baa7b6717ad29961e50911.zip |
sorting by language
Diffstat (limited to 'aoc2015/day-03')
-rw-r--r-- | aoc2015/day-03/day-03.rkt | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/aoc2015/day-03/day-03.rkt b/aoc2015/day-03/day-03.rkt deleted file mode 100644 index 1d44955..0000000 --- a/aoc2015/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) |