fix assign to final bugs in aoc
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
(load "../UtilMacros.kiss")
|
||||
|
||||
(defMacro dictInc [theMap key amount]
|
||||
`(let [theMap ,theMap key ,key amount ,amount &mut count (dictGet theMap key)]
|
||||
`(let [&mut theMap ,theMap key ,key amount ,amount &mut count (dictGet theMap key)]
|
||||
(unless count
|
||||
(dictSet theMap key (set count (Int64Helper.fromFloat 0))))
|
||||
(dictSet theMap key (set count 0i64)))
|
||||
(dictSet theMap key #{count + amount;}#)))
|
||||
|
||||
// Remove and return an arbitrary key-value pair from the given Map
|
||||
|
@@ -5,10 +5,10 @@
|
||||
// special key -1 corresponds to total count
|
||||
(dictSet theMap -1 (Int64Helper.fromFloat list.length))
|
||||
(doFor age (range 9)
|
||||
(dictSet theMap age (Int64Helper.fromFloat 0)))
|
||||
(dictSet theMap age 0i64))
|
||||
(doFor age list
|
||||
(let [count (dictGet theMap age)
|
||||
one (Int64Helper.fromFloat 1)]
|
||||
one 1i64]
|
||||
(dictSet theMap age #{count + one;}#)))
|
||||
theMap))
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
(= 2518
|
||||
(apply +
|
||||
(for group (groups (Util.readLines (input 3)) GROUP_SIZE)
|
||||
(let [freqMap (emptyGroupPossessionMap)
|
||||
(let [&mut freqMap (emptyGroupPossessionMap)
|
||||
&mut badge ""]
|
||||
(doFor [idx :String elf] (enumerate group)
|
||||
(doFor char (elf.split "")
|
||||
|
Reference in New Issue
Block a user