aboutsummaryrefslogtreecommitdiff
path: root/2022/day-06/day-06.rkt
diff options
context:
space:
mode:
authorHunky Jimpjorps <thechairman@thechairman.info>2022-12-06 12:59:21 -0500
committerHunky Jimpjorps <thechairman@thechairman.info>2022-12-06 12:59:21 -0500
commitf5cd4dfa7d3bcdfcc18312d2ca55a476dca956b5 (patch)
tree13bb3435607401ea398c9baf81be30a7dabd263c /2022/day-06/day-06.rkt
parentdee026d9be9756f9b19e278724543b51a69dd048 (diff)
downloadgleam_aoc-f5cd4dfa7d3bcdfcc18312d2ca55a476dca956b5.tar.gz
gleam_aoc-f5cd4dfa7d3bcdfcc18312d2ca55a476dca956b5.zip
day 6 cleanup
Diffstat (limited to '2022/day-06/day-06.rkt')
-rw-r--r--2022/day-06/day-06.rkt11
1 files changed, 5 insertions, 6 deletions
diff --git a/2022/day-06/day-06.rkt b/2022/day-06/day-06.rkt
index 4eb8323..89b8075 100644
--- a/2022/day-06/day-06.rkt
+++ b/2022/day-06/day-06.rkt
@@ -1,20 +1,19 @@
#lang racket
(require advent-of-code
- threading
(only-in relation ->list ->set)
(only-in algorithms sliding))
-(define buffer (~> (fetch-aoc-input (find-session) 2022 6)))
+(define buffer (fetch-aoc-input (find-session) 2022 6))
(define (find-marker data type)
(define n
- (match type
- ['start-of-packet 4]
- ['start-of-message 14]))
+ (case type
+ [(start-of-packet) 4]
+ [(start-of-message) 14]))
(for/first ([chunk (in-list (sliding (->list data) n))]
[i (in-naturals n)]
- #:when (= n (~> chunk remove-duplicates length)))
+ #:unless (check-duplicates chunk))
i))
;; part 1