Last active
January 26, 2018 04:36
-
-
Save quoll/b3f1d289358435e5d76268c14228f9ce to your computer and use it in GitHub Desktop.
This file contains 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
(defn day3* [input] | |
(loop [i 2 mem [1 1]] | |
(let [[x y] (coords i) | |
v (apply + (for [p [-1 0 1] q [-1 0 1] | |
:let [f (offset (+ x p) (+ y q))] | |
:when (< f i)] | |
(get mem f)))] | |
(if (> v input) | |
v | |
(recur (inc i) (conj mem v)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment