From 1193349b200e2cd3b8d0c7fad2b5644075d94374 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 27 Aug 2020 18:21:30 +0700 Subject: [PATCH 1/3] Rework Memory.read method to have more convenient calls with result --- .../src/commonMain/kotlin/scientifik/memory/Memory.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kmath-memory/src/commonMain/kotlin/scientifik/memory/Memory.kt b/kmath-memory/src/commonMain/kotlin/scientifik/memory/Memory.kt index daae0c3d2..177c6b46b 100644 --- a/kmath-memory/src/commonMain/kotlin/scientifik/memory/Memory.kt +++ b/kmath-memory/src/commonMain/kotlin/scientifik/memory/Memory.kt @@ -83,9 +83,12 @@ interface MemoryReader { /** * Uses the memory for read then releases the reader. */ -inline fun Memory.read(block: MemoryReader.() -> Unit) { +inline fun Memory.read(block: MemoryReader.() -> R): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - reader().apply(block).release() + val reader = reader() + val result = reader.block() + reader.release() + return result } /** From 924a1d1f382d221b9f3321f26478ef6d79dae448 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 29 Aug 2020 10:39:04 +0300 Subject: [PATCH 2/3] Add publications --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a081ceedd..24a7d7a4a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ Bintray-dev: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmat Could be pronounced as `key-math`. The Kotlin MATHematics library is intended as a Kotlin-based analog to Python's `numpy` library. In contrast to `numpy` and `scipy` it is modular and has a lightweight core. +## Publications +* [A conceptual article about context-oriented design](https://proandroiddev.com/an-introduction-context-oriented-programming-in-kotlin-2e79d316b0a2) +* [Another article about context-oriented design](https://proandroiddev.com/diving-deeper-into-context-oriented-programming-in-kotlin-3ecb4ec38814) +* [ACAT 2019 conference paper](https://aip.scitation.org/doi/abs/10.1063/1.5130103) + # Goal * Provide a flexible and powerful API to work with mathematics abstractions in Kotlin-multiplatform (JVM and JS for now and Native in future). * Provide basic multiplatform implementations for those abstractions (without significant performance optimization). From 6db921e935a0235eff99ae93576ca42caafc6fe4 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 6 Sep 2020 19:03:24 +0300 Subject: [PATCH 3/3] Update README.md --- kmath-core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-core/README.md b/kmath-core/README.md index 24e2c57d3..aed33a257 100644 --- a/kmath-core/README.md +++ b/kmath-core/README.md @@ -1,4 +1,4 @@ -# The Core Module (`kmath-ast`) +# The Core Module (`kmath-core`) The core features of KMath: