chore(pre-commit): autoupdate

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-12-02 16:06:24 +01:00
parent b3b129a03e
commit a29c0008d8
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8
2 changed files with 10 additions and 9 deletions

View file

@ -7,7 +7,7 @@ repos:
- id: check-yaml - id: check-yaml
- id: check-added-large-files - id: check-added-large-files
repo: https://github.com/pre-commit/pre-commit-hooks repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 rev: v5.0.0
- hooks: - hooks:
- args: - args:
@ -16,7 +16,7 @@ repos:
exclude: ^\.idea/fileTemplates/.*\.kt$ exclude: ^\.idea/fileTemplates/.*\.kt$
id: pretty-format-kotlin id: pretty-format-kotlin
repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0 rev: v2.14.0
- hooks: - hooks:
- id: commitizen - id: commitizen
@ -24,4 +24,4 @@ repos:
stages: stages:
- push - push
repo: https://github.com/commitizen-tools/commitizen repo: https://github.com/commitizen-tools/commitizen
rev: v3.15.0 rev: v4.0.0

View file

@ -75,13 +75,14 @@ fun readInputAsCommaSeparatedInts(
fun readGraph( fun readGraph(
day: Int, day: Int,
name: String, name: String,
) = readInput(day, name).fold(mapOf<String, Set<String>>()) { currentGraph, edge -> ) = readInput(day, name)
val (fromVertex, toVertex) = edge.split("-") .fold(mapOf<String, Set<String>>()) { currentGraph, edge ->
val fromNeighbours = currentGraph.getOrDefault(fromVertex, emptySet()) + toVertex val (fromVertex, toVertex) = edge.split("-")
val toNeighbours = currentGraph.getOrDefault(toVertex, emptySet()) + fromVertex val fromNeighbours = currentGraph.getOrDefault(fromVertex, emptySet()) + toVertex
val toNeighbours = currentGraph.getOrDefault(toVertex, emptySet()) + fromVertex
currentGraph + mapOf(fromVertex to fromNeighbours, toVertex to toNeighbours) currentGraph + mapOf(fromVertex to fromNeighbours, toVertex to toNeighbours)
}.toMap() }.toMap()
/** /**
* Constructs product of two sequences. * Constructs product of two sequences.