This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (setf day10-input '(189 1 111 246 254 2 0 120 215 93 255 50 84 15 94 62)) | |
| (defun reverse-sublist (list beg end) | |
| (let ((rotated-list (-rotate (- beg) list)) | |
| (nend (- end beg))) | |
| (setf (subseq rotated-list 0 nend) (reverse (subseq rotated-list 0 nend))) | |
| (-rotate beg rotated-list))) | |
| (defun make-hash-list (size) | |
| (let ((result '())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (setf day10-input "189,1,111,246,254,2,0,120,215,93,255,50,84,15,94,62") | |
| (defun reverse-sublist (list beg end) | |
| (let ((rotated-list (-rotate (- beg) | |
| list)) | |
| (nend (- end beg))) | |
| (setf (subseq rotated-list 0 nend) (reverse (subseq rotated-list 0 nend))) | |
| (-rotate beg rotated-list))) | |
| (defun make-hash-list (size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; -*- lexical-binding: t -*- | |
| (defstruct scanner | |
| (depth 0) | |
| (range 0)) | |
| (defun score (scanner &optional delay) | |
| (unless delay (setf delay 0)) | |
| (if (= 0 (mod (+ (scanner-depth scanner) delay) | |
| (* 2 (1- (scanner-range scanner))))) |
OlderNewer