]> code.bitgloo.com Git - clyne/advent-of-code.git/commitdiff
day2: one more update
authorClyne Sullivan <clyne@bitgloo.com>
Fri, 3 Dec 2021 14:20:18 +0000 (09:20 -0500)
committerClyne Sullivan <clyne@bitgloo.com>
Fri, 3 Dec 2021 14:20:18 +0000 (09:20 -0500)
day2/part1.clj

index 6b092127d10720a00951df579ab40c79907c34cd..d301b37179b4bdd4b9cd3c9ee03d840b93e5996f 100644 (file)
             n (Integer/parseInt (second ins))
             ]
         (recur
-          (case (first ins)
-            "forward" (update-in data [:xpos] + n)
-            "up" (update-in data [:depth] - n)
-            "down" (update-in data [:depth] + n)
+          (apply (partial update-in data)
+            (case (first ins)
+              "forward" [[:xpos] + n]
+              "up" [[:depth] - n]
+              "down" [[:depth] + n]
+              )
             )
           )
         )