Advent of Code 2021 day 10
12/10/2021, 5:00 AMDavid Whittaker
12/10/2021, 5:25 AMSimon Nyström
12/10/2021, 5:52 AMSimon Nyström
12/10/2021, 5:53 AMMarcin Wisniowski
12/10/2021, 6:05 AMnkiesel
12/10/2021, 6:15 AMMichael Böiers
12/10/2021, 6:22 AMDavid Whittaker
12/10/2021, 6:51 AMmapNotNull
- nice!David Whittaker
12/10/2021, 6:52 AMwhen
for the scoring table, but I like Marcin's approach of using a map so it can be indexed. I'll have to remember that for next opportunity.Dan Fingal-Surma
12/10/2021, 7:12 AMDan Fingal-Surma
12/10/2021, 7:14 AMDan Fingal-Surma
12/10/2021, 7:17 AMTobias Suchalla
12/10/2021, 7:24 AMephemient
12/10/2021, 7:47 AMPaul Woitaschek
12/10/2021, 8:50 AMMichael Böiers
12/10/2021, 8:50 AMprivate val pairs = "([{<".zip(")]}>").toMap()
🆒kqr
12/10/2021, 9:45 AMMichael Böiers
12/10/2021, 11:02 AMgnu
12/10/2021, 2:45 PMMichael de Kaste
12/10/2021, 2:48 PMPaul Woitaschek
12/10/2021, 2:50 PMMichael de Kaste
12/10/2021, 3:27 PMPaul Woitaschek
12/10/2021, 3:27 PMMichael de Kaste
12/10/2021, 3:44 PMlist.filterIsInstance(YourSealedClass.SubType1::class.java)
but that means that every time you go over the list, you're rechecking types. So your best bet would be to group this list of sealed classes by its type.
If I know I have a Map<SealedClassType, SealedClassInstance>, I should just be able to do map[SealedClassType] and get the instance in the correct subtype; this is all just me thinking out loud but it just feels like sealed classes could have a very efficient map implementation.Luke
12/10/2021, 4:26 PMEither
for practice.
https://github.com/TheSunshinator/Advent-of-Code-2021/blob/main/src/day10/DailySolution.ktphldavies
12/10/2021, 9:58 PMKiet
12/11/2021, 10:28 PM