-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaoc.rkt
58 lines (43 loc) · 1.08 KB
/
aoc.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#lang racket/base
(require racket/string
advent-of-code
advent-of-code/input
advent-of-code/answer)
(provide ;open-input
get-input
submit1
submit2
day
year
example
d
lines
map-lines
input-lines)
(define day (make-parameter #f))
(define year (make-parameter 2024))
(define example (make-parameter #f))
#|
(define (open-input)
(open-aoc-input (find-session) (year) (day) #:cache #t))
|#
(define (get-input)
(if (example) (example)
(fetch-aoc-input (find-session) (year) (day) #:cache #t)))
(define (submit part answer)
(define result (aoc-submit (find-session) (year) (day) part answer))
(if (string-contains? result "already complete")
(format "Part ~v already done: ~v" part answer)
result))
(define (submit1 answer)
(submit 1 answer))
(define (submit2 answer)
(submit 2 answer))
;;
(define d displayln)
(define (lines str)
(string-split str "\n"))
(define (map-lines f str)
(map f (lines str)))
(define (input-lines)
(lines (get-input)))