mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 11:23:17 -09:00
compute map
This commit is contained in:
parent
779d66ec7f
commit
4e7d3a5893
@ -12,15 +12,10 @@
|
|||||||
(re-find #"\d" (string/reverse %)))))
|
(re-find #"\d" (string/reverse %)))))
|
||||||
(reduce +))
|
(reduce +))
|
||||||
|
|
||||||
(def numeric-value-map {"one" 1
|
(def numeric-value-map
|
||||||
"two" 2
|
(->> ["one" "two" "three" "four" "five" "six" "seven" "eight" "nine"]
|
||||||
"three" 3
|
(map-indexed (fn [idx val] [val (inc idx)]))
|
||||||
"four" 4
|
(into {})))
|
||||||
"five" 5
|
|
||||||
"six" 6
|
|
||||||
"seven" 7
|
|
||||||
"eight" 8
|
|
||||||
"nine" 9})
|
|
||||||
(defn numeric-value [s]
|
(defn numeric-value [s]
|
||||||
(or (numeric-value-map s) s))
|
(or (numeric-value-map s) s))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user