Skip to content

Commit

Permalink
Implment functions needed for morning of Day 1
Browse files Browse the repository at this point in the history
  • Loading branch information
codingzorro committed Jan 14, 2024
1 parent 96ec60a commit 2fb6db2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/advent2023/day01.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
(ns advent2023.day01)

(defn- as-number
"convert [1 2] into 12"
[[a b]]
(+ (* a 10) b))



(defn decode
"extract digits in a string; e.g. \"a1b2\" --> [1 2]"
[a-string]
Expand All @@ -11,4 +18,6 @@
"Create a two-digit integer using the first and last elements of a given
array of digits"
[an-array]
42)
(->> an-array
(#(vector (first %) (last %)))
as-number))

0 comments on commit 2fb6db2

Please sign in to comment.