• Skip to main content
  • Skip to footer

PurelyFunctional.tv

  • Learn Clojure
  • About
  • 🛒 Cart
  • Log in

Learn a powerful concurrency tool that makes complex coordination easy

Clojure is known for its powerful concurrency tools. It comes with a suite of primitives for managing shared mutable state. But how do you write code with multiple threads that communicate and coordinate with each other? In 2013, the Clojure team introduced core.async, an implementation of Communicating Sequential Processes for Clojure. It is a powerful, easily reasoned abstraction for writing highly concurrent code. It works in both Clojure and ClojureScript.

In this course, we go through the fundamentals with a real example. You'll learn:

  • Why you want channels between your workers
  • How to identify bottlenecks and eliminate them
  • How to deal with deadlock
  • A process for analyzing a network of workers
  • Techniques for mastering time
  • When and how to multitask
  • How to break up tasks into smaller subtasks

Clojure core.async

Updated February 26, 2021

Want this course?

Online License

$48
Get this course
--
Watch Online
Lifetime Access
For an individual
Buy for $48

Love it or leave it guarantee

If you don't learn as much from this course as you thought, just ask for a refund within 30 days and I'll give you your money back.

Video time: 01h25m
0 / 11
0 / 11

Lessons

5 min

1. The Factory

This lesson introduces you to Jennifer and Mark. Jennifer owns a toy factory and Mark builds toy cars. You'll begin to decompose a sequential process into the steps that will execute concurrently.

8 min

2. Hiring (Increasing Concurrency)

In this lesson, you get to work and start hiring more workers. You learn about go blocks, the powerful macro that enables core.async. You'll make several go blocks, see how they work, and start to make the process of building cars concurrent.

14 min

3. Assembly Line (Coordinating Between Processes)

In this lesson, things start getting serious. You've hired more workers, now they need to work together to build cars. And the common technique in factories is to use an assembly line. Learn to create patterns of communication between your processes using channels.

5 min

4. Conveyor Belts (Communicating using Channels)

Central to any modern factory are conveyor belts. In this lesson, you learn about buffers, which are like conveyor belts between go blocks.

7 min

5. Closing Shop (Stopping Processes)

This lesson addresses some issues that came up with the switch to conveyor belts. How do we tell everyone to stop working when the trucks are loaded and ready to ship? We don't want them to keep building cars. Learn about how to close channels so that they don't accept any more work.

7 min

6. Reducing Waste (Optimization)

In this lesson, the assembly line is shaping up. Now Jennifer is trying to make it more efficient. We begin looking at it at a high level and eliminating wasted work.

8 min

7. Deadlock (When No One Can Work)

In this lesson, we look at some problem areas where we could experience deadlock - our workers waiting forever. Looking at the problem in a picture makes it clear what we can do.

4 min

8. Consolidate (Scaling the right jobs)

In this lesson, we finally consolidate the work and improve scalability by analyzing the diagram of our assembly line.

5 min

9. Pomodoro (Incorporating Timers)

In this lesson, we turn our attention to management. Jennifer is trying out some productivity techniques in her office. Right now, she's implementing Pomodoro. We use core.async to sequence it.

14 min

10. Multitasking (Doing work while waiting for other work)

In this lesson, we learn how to do work while we are waiting for another go block to do other work. That means while we're waiting for a phone call, we can be planning our year. But if the phone rings, we stop what we're doing and answer it.

7 min

11. Refactoring (Patterns for go-block components)

In this lesson, we refactor the Pomodoro code by allowing us to turn asynchronous processes into synchronous ones.

Extra Resources

Clojure core.async Reference Sheet

Overwhelmed by the number of functions in Clojure core.async? This reference sheet shows you just the essentials in an easy-to-follow format.

Footer CTA

Level up your Clojure skills

The PurelyFunctional.tv Newsletter is a weekly email that helps you improve your Clojure skills through challenges, tips, and news.

Enter your email address to receive emails about Clojure and Functional Programming. These include the weekly newsletter and occasional offers. You can unsubscribe any time.

Copyright © 2021 LispCast and Eric Normand