mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 09:23:17 -09:00
use regex n-repeat
This commit is contained in:
parent
8a5bba8f29
commit
126b3a4768
@ -10,7 +10,7 @@
|
|||||||
returns list of parsed integral multiplication results"
|
returns list of parsed integral multiplication results"
|
||||||
[s]
|
[s]
|
||||||
(->> s
|
(->> s
|
||||||
(re-seq #"mul\((\d\d?\d?),(\d\d?\d?)\)")
|
(re-seq #"mul\((\d{1,3}),(\d{1,3})\)")
|
||||||
(map rest)
|
(map rest)
|
||||||
(map #(map parse-long %))
|
(map #(map parse-long %))
|
||||||
(map #(reduce * %))))
|
(map #(reduce * %))))
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
;; part 2
|
;; part 2
|
||||||
(->> input
|
(->> input
|
||||||
(c/re-pos #"mul\((\d\d?\d?),(\d\d?\d?)\)|(do\(\))|(don't\(\))")
|
(c/re-pos #"mul\((\d{1,3}),(\d{1,3})\)|(do\(\))|(don't\(\))")
|
||||||
(sort-by key)
|
(sort-by key)
|
||||||
(reduce
|
(reduce
|
||||||
(fn [acc [_idx instr]]
|
(fn [acc [_idx instr]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user