contents

 

Front matter

preface

acknowledgments

about this book

Who should read this book

What you’ll learn

Pushing abstraction further

Immutability

Referential transparency

Encapsulated state mutation sharing

Abstracting control flow and control structures

Using the right types

Laziness

Audience

How this book is organized: A roadmap

Completing the exercises

Learning the techniques in this book

About the code

liveBook discussion

about the author

about the cover illustration

  1 Making programs safer

1.1 Programming traps

1.1.1 Safely handling effects

1.1.2 Making programs safer with referential transparency

1.2 The benefits of safe programming

1.2.1 Using the substitution model to reason about programs

1.2.2 Applying safe principles to a simple example

1.2.3 Pushing abstraction to the limit

Summary

  2 Functional programming in Kotlin: An overview

2.1 Fields and variables in Kotlin

2.1.1 Omitting the type to simplify

2.1.2 Using mutable fields

2.1.3 Understanding lazy initialization

2.2 Classes and interfaces in Kotlin