This is the first question I found myself missing ...
# advent-of-code
n
This is the first question I found myself missing anything from C++. Namely, the combination of const + value semantics. In the optimized solution I ended up with, I have a data class:
Copy code
data class State(val accumulator: Int, val index: Int)
The solution gets pretty ugly in places because mutating State is a pain. On the other hand, using var and doing mutation could very easily leave me with two State variables pointing at the same instance, and then I'd have surprising mutations. Nicer syntax (than copy) for "fake mutating" an immutable type like
State
would be helpful