My favorite examples of functional programming in the language Kotlin

One of the great features of Kotlin is that it supports functional programming. Let's look at and discuss some simple but expressive functions written in Kotlin.
 
My favorite examples of functional programming in the language Kotlin
Superset (Boolean)
 
If you studied algebra at a university, you can recall what a superset is. For any set, its superset is the set of all its subsets, including the original set itself and the empty set. For example, if we have the following set:
 
{??3}
 
Then his superset:
 
{{}, {1}, {2}, {3}, {?2}, {?3}, {?3}, {??3}}
 
In algebra such a function is very useful. How do we implement it?
 
If you want to challenge yourself, stop reading ...
+ 0 -

KDispatcher is an easy and convenient eventbus for daily use of

Hello, dear colleagues, lovers of Kotlin
 
 
In my first article, I want to tell you about one useful library that I wrote, exclusively on Kotlin, and actively support and develop. It is called, KDispatcher. It is intended for distribution and subscription of notices between your code components. You can use it in any kotlin project, be it Android, Frontend, Backend or KotlinNative.
 
 
The main advantages:
 
 
 
Fast and easy subscription to
events.  
Priority of calls of functions-listeners (callbacks)
 
Using kotlin extension functions
 
Stream safety
 
...
+ 0 -

Kotlin DSL: Theory and Practice

Kotlin DSL: Theory and PracticeDeveloping application tests is not a pleasant experience. This process takes a long time, requires a lot of concentration and is extremely in demand. The Kotlin language provides a set of tools that allows you to easily build your own problem-oriented language (DSL). There is an experience when Kotlin DSL replaced builders and static methods for testing the resource planning module, which turned the addition of new tests and support of old from routine into an exciting process.
 
 
In the course of the article, we will analyze all the main tools from the developer's arsenal and how they can be ...
+ 0 -

Extension of PHP and Kotlin Native. Part two, conscious

 
Extension of PHP and Kotlin Native. Part two, conscious

Summary first part :


 
 
Installing and configuring the toolkit.
 
Writing the function helloWorld () on Kotlin Native and compiling it into a shared library.  
Access this function from the C code of the PHP extension.  

 
 
In this article I will talk about creating tools for writing PHP extensions without having to touch C, exclusively on K /N.
 
 
To whom it is interesting - welcome under kat.
 
Who is not interested in reading, but just want to see - welcome to github
 
 

 
 
...[/h]
+ 0 -

ActionViews or how I do not like boilerplate from the very childhood

Hello, Habr! In this article, I want to share my experience creating my mechanism for automating the display of various View types: ContentView, LoadingView, NoInternetView, EmptyContentView, ErrorView.
 
ActionViews or how I do not like boilerplate from the very childhood
 
 
It was a long journey. The path of trial and error, a search of methods and options, sleepless nights and an invaluable experience that I want to share, and hear criticism that I will definitely take into account.
 
I will say at once that I will consider working on RxJava, since for coroutines I did not do such a mechanism - my hands did not reach. And for other similar tools (Loaders, AsyncTask, and ...
+ 0 -

We collapse on a maximum: from ORM to the analysis of bytecode

As you know, a real programmer in his life has to do 3 things: create your own programming language, write your operating system and make your ORM. And if I've written a language for a long time (maybe I'll tell you some other time), but the OS is still waiting, then I want to tell about ORM right now. And more precisely, it's not even about ORM itself, but about the implementation of one small, local and, as it seemed initially, quite simple feature.
 
Together we will go all the way from the joy of finding a simple solution to the bitterness of realizing its fragility and incorrectness. From ...
+ 0 -

We invite you to Java Meetup in Raiffeisenbank

The internal community of Java developers Raiffeisenbank invites to its first open Mitap, which will be held on the site of the Moscow office in Nagatino, 28 June .
 
 
We invite you to Java Meetup in Raiffeisenbank  
fill the form.
 
 
In the Java mitapa program, we are waiting for four reports from the speakers of Raiffeisenbank and colleagues from Infobip. Start of papers in 18:00 , we'll open the registration in 17:30 .
 
 
The program:
 
 
Viktor Tsvetkov, Raiffeisenbank
 
 
CRDT: relationships at a distance. How to resolve conflicts in distributed systems
 
 
Andrey Markelov, Infobip
 
 
Redis anti-patterns ...
+ 0 -

Swift and Kotlin - about the most important differences between these languages ​​

Swift and Kotlin - about the most important differences between these languages ​​  
 
Hello colleagues. The title is self-evident, we invite you to familiarize yourself with the translation of an interesting article by Krzysztof Turek. Also note that the author notices interesting improvements that distinguish Kotlin from Java when developing for Android. Word to the author:
 
 
Probably, many of you have seen the following comparison of Swift and Kotlin: nilhcem.com/swift-is-like-kotlin . It turned out quite interesting, right? I agree that there are many parallels between these languages, but in this article I would like to discuss some important differences between them.
 
...
+ 0 -

JetBrains Open Day Moscow: results and video

+ 0 -