Book Image

Clojure Reactive Programming

Book Image

Clojure Reactive Programming

Overview of this book

Table of Contents (19 chapters)
Clojure Reactive Programming
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Bibliography
Index

Fetching data in parallel


To understand better the issues outlined in the previous section, let's build a more complex example that fetches data about one of my favorite movies, The Lord of the Rings.

The idea is that given the movie, we wish to retrieve its actors and, for each actor, retrieve the movies they have been a part of. We also would like to find out more information about each actor, such as their spouses.

Additionally, we will match each actor's movie against the list of top five movies in order to highlight them as such. Finally, the result will be printed to the screen.

From the problem statement, we identify the following two main characteristics we will need to account for:

  • Some of these tasks need to be performed in parallel

  • They establish dependencies on each other

To get started, let's create a new leiningen project:

lein new clj-futures-playground

Next, open the core namespace file in src/clj_futures_playground/core.clj and add the data we will be working with:

(ns clj-futures...