blob: 31c0d3dbb90009ee6cb96a53a9748367924e696b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#lang racket
(require advent-of-code
threading
simple-polynomial/tools)
(define histories
(for/list ([raw-history (in-lines (open-aoc-input (find-session) 2023 9 #:cache #true))])
(~>> raw-history string-split (map string->number))))
(for/lists (left right #:result (cons (apply + left) (apply + right)))([history (in-list histories)])
(define f (interpolate-at-integer-points history))
(values (f -1) (f (length history))))
|