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