From f03047b5db88a32d434409f294480f387bd4aa33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20R=C3=B8dland?= Date: Thu, 14 Dec 2023 16:42:42 +0100 Subject: [PATCH] 2023 - Day 14 - better naming for fun: rev => reverseEachLine --- src/main/kotlin/no/rodland/advent_2023/Day14.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/no/rodland/advent_2023/Day14.kt b/src/main/kotlin/no/rodland/advent_2023/Day14.kt index 2dc69283..530d06f3 100644 --- a/src/main/kotlin/no/rodland/advent_2023/Day14.kt +++ b/src/main/kotlin/no/rodland/advent_2023/Day14.kt @@ -33,12 +33,12 @@ class Day14(val input: List) : Day> { return cycle.load() } - private fun List.rev() = map { it.reversed() } + private fun List.reverseEachLine() = map { it.reversed() } private fun List.load() = sumOf { it.load() } - private fun List.cycle() = tilt().rotateLeft().rev() - .tilt().reversed().rotateLeft().rev() - .tilt().reversed().rotateLeft().rev() - .tilt().reversed().rotateLeft().asReversed().rev() + private fun List.cycle() = tilt().rotateLeft().reverseEachLine() + .tilt().reversed().rotateLeft().reverseEachLine() + .tilt().reversed().rotateLeft().reverseEachLine() + .tilt().reversed().rotateLeft().asReversed().reverseEachLine() private fun List.tilt() = map { line -> collapsed(line) }