From 5e95d24fa789443f64a303deacf73da2e5e11c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C3=B3=C5=82grabia?= Date: Mon, 20 Jan 2025 22:05:42 +0100 Subject: [PATCH] Small refactoring. --- 2025/01/kotlin_demo1/README.md | 3 +++ 2025/01/kotlin_demo1/build.gradle | 2 +- 2025/01/kotlin_demo1/src/main/kotlin/Program.kt | 3 --- .../main/kotlin/pl/polgrabia/demos/kotlin/Program.kt | 12 ++++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 2025/01/kotlin_demo1/README.md delete mode 100644 2025/01/kotlin_demo1/src/main/kotlin/Program.kt create mode 100644 2025/01/kotlin_demo1/src/main/kotlin/pl/polgrabia/demos/kotlin/Program.kt diff --git a/2025/01/kotlin_demo1/README.md b/2025/01/kotlin_demo1/README.md new file mode 100644 index 0000000..5bcd79d --- /dev/null +++ b/2025/01/kotlin_demo1/README.md @@ -0,0 +1,3 @@ +# Basic kotlin project + +The goal was to test how easy / hard is to write kotlin in vim :-). diff --git a/2025/01/kotlin_demo1/build.gradle b/2025/01/kotlin_demo1/build.gradle index cd4ea39..0c0fd16 100644 --- a/2025/01/kotlin_demo1/build.gradle +++ b/2025/01/kotlin_demo1/build.gradle @@ -12,5 +12,5 @@ kotlin { tasks.register('runApp', JavaExec) { classpath = sourceSets.main.runtimeClasspath - mainClass = "ProgramKt" + mainClass = "pl.polgrabia.demos.kotlin.ProgramKt" } diff --git a/2025/01/kotlin_demo1/src/main/kotlin/Program.kt b/2025/01/kotlin_demo1/src/main/kotlin/Program.kt deleted file mode 100644 index 81cfcd8..0000000 --- a/2025/01/kotlin_demo1/src/main/kotlin/Program.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun main() { - println("Hello World!!!") -} diff --git a/2025/01/kotlin_demo1/src/main/kotlin/pl/polgrabia/demos/kotlin/Program.kt b/2025/01/kotlin_demo1/src/main/kotlin/pl/polgrabia/demos/kotlin/Program.kt new file mode 100644 index 0000000..48aef6e --- /dev/null +++ b/2025/01/kotlin_demo1/src/main/kotlin/pl/polgrabia/demos/kotlin/Program.kt @@ -0,0 +1,12 @@ +package pl.polgrabia.demos.kotlin + +import kotlin.collections.* + +fun main() { + // val data = listOf(1, 2, 3, 4) + val data : Array = Array(10) { 1 } + val s = data.reduceOrNull ({ r,v -> + r + v + }) + println("Hello World!!! Sum: $s") +}