Book Image

Functional Kotlin

Book Image

Functional Kotlin

Overview of this book

Functional programming makes your application faster, improves performance, and increases your productivity. Kotlin supports many of the popular and advanced functional features of functional languages. This book will cover the A-Z of functional programming in Kotlin. This book bridges the language gap for Kotlin developers by showing you how to create and consume functional constructs in Kotlin. We also bridge the domain gap by showing how functional constructs can be applied in business scenarios. We’ll take you through lambdas, pattern matching, immutability, and help you develop a deep understanding of the concepts and practices of functional programming. If you want learn to address problems using Recursion, Koltin has support for it as well. You’ll also learn how to use the funKtionale library to perform currying and lazy programming and more. Finally, you’ll learn functional design patterns and techniques that will make you a better programmer.By the end of the book, you will be more confident in your functional programming skills and will be able to apply them while programming in Kotlin.
Table of Contents (22 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
Index

Writing and running Kotlin


We'll cover a comprehensive set of options to write and run Kotlin, from the easiest to the most professional.

Kotlin online

Nothing to install, just open Kotlin (https://try.kotlinlang.org/). Kotlin online includes everything that you need to write and run simple Koltin programs, including JVM and JavaScript compilation options. You can even create and save your programs if you have an account:

On your console

For anything serious and destined to be in production code, the online option isn't optimal. Let's explore how to install it on your machine.

Installing SDKMAN

The most accessible option to install Kotlin is to use SDKMAN, a tool used to install and update JVM tools.

Use the following command to install SDKMAN (if you don't have it installed):

$ curl -s "https://get.sdkman.io" | bash

Once SDKMAN is installed, we can use it to install Kotlin and keep it updated, among other tools such as Gradle and Maven.

Installing Kotlin through SDKMAN

To install Kotlin through SDKMAN...