Rob Pike gave an interesting talk on latest Google I/O "Go Concurrency Patterns" with excellent examples of how to write simple but powerful concurrency code using goroutines and channels (his talk on youtube:
http://www.youtube.com/watch?v=f6kdp27TYZs&feature=youtu.be). My idea was to implement the same examples with Clojure and Lamina library which provides event-driven workflow for Clojure (on github:
https://github.com/ztellman/lamina/). As the result for this I have two gists:
1. Golang examples from talk -
https://gist.github.com/3124594
Several things was implemented using different approach from origin, cause of different paradigms and workflows. But I think, that in general, this code blocks can act both as basic for article about channels-driven concurrency with Clojure (which I plan to write in nearest future) and good addition to Lamina-project's documentation. Unfortunately I didn't find enough documentation for Lamina project (in general library is great, but some things are not straightforward and hard to use without examples/clarifications).
I didn't use such approach for concurrency programming yet, so I want to ask community to check/review/update code in terms of best practices. I know that there are some problems, which possible can be resolved in more efficient/beautiful way (there are several TODOs in comments). I would greatly appreciate any comments/ideas/suggestions on how to make this code better.
--
Kind regards,
Alexey S. Kachayev, CTO at KitApps, Inc.
----------
Twitter: @kachayev