Skip to content

Conversation

@scarf005
Copy link
Contributor

@scarf005 scarf005 commented Dec 6, 2025

No description provided.

@scarf005 scarf005 changed the title docs: blogpost for 2025 day 06 docs(2025): day 06 writeup Dec 6, 2025
@SethTisue
Copy link
Collaborator

let's merge on Tuesday, to give time for review feedback (which I've asked for on Discord)


```scala
extension (xs: IterableOnce[(symbol: String, nums: IterableOnce[String])])
inline def calculate: Long = xs.iterator.collect {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline probably unnecessary

Let's define an [extension method](https://docs.scala-lang.org/scala3/reference/contextual/extension-methods.html) to improve readability.

```scala
extension (xs: IterableOnce[(symbol: String, nums: IterableOnce[String])])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this takes an xs: Iterator[...] it'll be more apparent how it connects, plus...

```scala
def part2(input: String): Long =
val lines = input.linesIterator.toVector
val ops = lines.last.split(raw"\s+").toVector
Copy link
Contributor

@merlinorg merlinorg Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can then be .iterator instead of toVector and then it's just (ops zip xss).calculate which removes the lazyZip complexity. My reasoning being that you chose to make ops a Vector, so the efficiency you speak of is for an inefficiency that is a bit self-imposed.

Just a suggestion to reduce some extraneous things.

else LGTM.

@SethTisue
Copy link
Collaborator

@scarf005 can you respond to the review feedback, please?

@scarf005
Copy link
Contributor Author

scarf005 commented Dec 9, 2025

@SethTisue @merlinorg applied in 7f346a6 (#896)

Co-authored-by: merlin <merlin@merlin.org>
Co-authored-by: Merlin Hughes <merlin@merlin.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants