aboutsummaryrefslogtreecommitdiff
path: root/2022/day-06/day-06.rkt
diff options
context:
space:
mode:
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