Preface

I have used Scala since its early days and have always appreciated its powerful combination of object-oriented and functional programming paradigms. In a world increasingly driven by AI, Scala’s core strengths in type safety, concurrency, expression-oriented syntax, and high performance on the JVM make it an excellent choice for building robust AI systems.

This book is a practical guide to building AI applications with Scala. We use Scala 3, the modern standard for Scala development, and scala-cli for running lightweight script-like projects and applications. My goal is to show you how classic AI search, neural networks, genetic algorithms, and natural language processing can be implemented cleanly in Scala. Furthermore, we explore how to integrate modern AI tools like large language models, semantic web technologies, and autonomous multi-agent frameworks into Scala applications.

Note: Dear reader, although I have been writing Scala code for many years, I partially relied on modern AI coding assistants (including DeepSeek, Gemini, and Claude models) to help develop, debug, and refine the example programs and for final edits on the manuscript for this book.

Who This Book Is For

This book is intended for programmers who want to explore building AI applications using Scala. You should have some familiarity with the Scala language, but the examples are designed to be clear and self-contained.

How To Read This Book

The examples in this book are designed to be run as standalone scala-cli projects. You can jump directly to any chapter that interests you. Each chapter explains the core algorithms and shows the complete, runnable code.

Open Source Example Programs and Manuscript Files

You can find all of the example programs and manuscript files in the book’s GitHub repository:

Acknowledgments

I would like to thank my wife Carol for editing this book. I would also like to thank the readers who have submitted corrections: none so far.