Summary
Concurrency, by its very nature, is a complex problem. While it's impossible to cover all the techniques you might need, hopefully, this chapter will provide you with the tools to get started. We covered the usage of pmap
and future
for using multiple threads. We also saw Clojure's reference types: var, atoms, agents, and refs. We used atoms to manage state in a browser-based ClojureScript application.
For each of these topics, there is a lot more that can be said. What you learn further down the road will depend on the kinds of problems you need to solve. Concurrency is one of the areas where the problems will be more diverse than almost any other. Familiarity with Clojure's basic approach to these questions will start you in the right direction when you search for solutions.
In the next chapter, we will take another big step toward real-world Clojure by learning how to interact with databases.