Skip to content

Commit 932dfba

Browse files
committed
Update #:cache to be #t by default in input-fetching functions.
Using input-fetching functions in solutions appears to be more common than I expected it to be when I first wrote this library. Changing the default means users have to deliberately choose to spam the website with requests.
1 parent a3c7e87 commit 932dfba

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

info.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(define build-deps '("scribble-lib" "racket-doc" "net-doc"))
55
(define scribblings '(("scribblings/advent-of-code.scrbl" ())))
66
(define pkg-desc "Package for fetching Advent of Code input.")
7-
(define version "1.0.2")
7+
(define version "1.0.3")
88
(define pkg-authors '(eutro))
99
(define raco-commands
1010
'(("aoc" (submod advent-of-code main) "Fetch Advent of Code puzzle input" #f)))

input.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
(define advent-day? (integer-in 1 25))
1818
(define advent-year? (and/c exact-integer? (>=/c 2015)))
1919

20-
(define (open-aoc-input session year day #:cache [cache #f])
20+
(define (open-aoc-input session year day #:cache [cache #t])
2121
(aoc-request session year "day" day "input" #:cache cache))
2222

23-
(define (fetch-aoc-input session year day #:cache [cache #f])
23+
(define (fetch-aoc-input session year day #:cache [cache #t])
2424
(port->string (open-aoc-input session year day #:cache cache)))

scribblings/advent-of-code.scrbl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,26 @@ A package for fetching Advent of Code input.
2020
@defproc[(open-aoc-input [session aoc-session?]
2121
[year advent-year?]
2222
[day advent-day?]
23-
[#:cache cache (or/c boolean? path-string?) #f])
23+
[#:cache cache (or/c boolean? path-string?) #t])
2424
input-port?]{
2525

2626
Fetch the puzzle input for @racket[day] of @racket[year] as an input port.
27-
28-
If you are using this in your puzzle solution, use of the @racket[cache]
29-
argument is highly recommended.
30-
3127
See @racket[aoc-request] for information on session, caching and error handling.
3228

29+
@history[#:changed "1.0.3" @elem{Made @racket[cache] be @racket[#t] by default.}]
30+
3331
}
3432

3533
@defproc[(fetch-aoc-input [session aoc-session?]
3634
[year advent-year?]
3735
[day advent-day?]
38-
[#:cache cache (or/c boolean? path-string?) #f])
36+
[#:cache cache (or/c boolean? path-string?) #t])
3937
string?]{
40-
4138
Fetch the input data as a string, using @racket[open-aoc-input].
39+
See @racket[open-aoc-input] and @racket[aoc-request] for information
40+
on session, caching and error handling.
4241

43-
See @racket[open-aoc-input].
42+
@history[#:changed "1.0.3" @elem{Made @racket[cache] be @racket[#t] by default.}]
4443

4544
}
4645

@@ -98,7 +97,7 @@ This is the HTML page that the site shows the user upon submitting an answer.
9897

9998
@defmodule[advent-of-code/request #:no-declare]
10099

101-
Procedures for making API requests. Reprovided by @racket[advent-of-code].
100+
Procedures for making API requests. Reprovided by @racketmodname[advent-of-code].
102101

103102
@defproc[(aoc-session? [x any/c]) boolean?]{
104103

@@ -162,7 +161,7 @@ Raises @racket[exn:fail:aoc] if the request fails.
162161

163162
@defmodule[advent-of-code/meta #:no-declare]
164163

165-
Meta and environment functions. Reprovided by @racket[advent-of-code].
164+
Meta and environment functions. Reprovided by @racketmodname[advent-of-code].
166165

167166
@defproc[(current-aoc-time) date?]{
168167

0 commit comments

Comments
 (0)