Also related to AoC earlier - does Kotlin have any...
# getting-started
a
Also related to AoC earlier - does Kotlin have any circular linked list data type or would I just use any Java implementation that I've previously had? My instincts tell me no since most Kotlin collections are based upon the Java ones.
k
I just appended the first element to the end of the list and used
zipWithNext
on it.
Ugly but elegant 😛.
But no, I don't think this exists in the Kotlin stdlib.
a
LOOOOL I DID THIS TOO. It's not so helpful for the second part, though.
k
What second part?
s
reminder that there's also
windowed
now
also not that helpful for part ii though
a
There's two parts to every AoC problem.
k
I only noticed the "sum of matching digits one" and got my golden star, what's the other one?
@stkent
zipWithNext
is also new in
1.2
.
👏 1
a
It's the same idea, but it's a circular list that wraps all the way around, so you might need to go beyond the "first" digit so it's not enough to just append it again.
That explains why I never heard of it.
k
I'll check it out later. You can emulate circular lists with
list[index % list.size]
if that helps.
a
That's what I've been told. I need to sit down and try that.