Book Image

Clojure Data Structures and Algorithms Cookbook

By : Rafik Naccache
Book Image

Clojure Data Structures and Algorithms Cookbook

By: Rafik Naccache

Overview of this book

Table of Contents (14 chapters)
Clojure Data Structures and Algorithms Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


core.async (pretty much like the Go language, from which it draws inspiration) evolves around the concepts of co-routines and channels. A co-routine is a lightweight unit of execution, so tiny that you can literally have thousands of them in your program without worrying. These co-routines are able to communicate using channels, which act as conveyer belts: a co-routine can put an item on it or can pick one from it.

Note

The concepts used in core.async and the Go language (http://golang.org) are based on Communicating Sequential Processes by C.A.R Hoare: (http://www.usingcsp.com/cspbook.pdf).

core.async co-routines are fired by wrapping some code inside a go block. An invoked go block will return the control directly to the caller code, and its processing will be done concurrently alongside the routine that originated it in some other process (not an operating system process or a thread, but something much lighter).

Channels are created using the chan function or any of its variants...