This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 18. All warfare is based on deception. | |
(ns pullrequest.join | |
(:require [clojure.core.reducers :as r] | |
[clojure.core.protocols :as p]) | |
(:import (java.util.concurrent.atomic AtomicLong))) | |
(defn update-index [key-fn h i] | |
(update-in h [(key-fn i)] (fnil conj #{}) [0 i])) | |
(defn probe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Channels-driven concurrency with Clojure | |
;; Clojure variant for code examples from this gist: | |
;; https://gist.github.com/3124594 | |
;; Primarily taken from Rob Pike's talk on Google I/O 2012: | |
;; http://www.youtube.com/watch?v=f6kdp27TYZs&feature=youtu.be | |
;; | |
;; Concurrency is the key to designing high performance network services. | |
;; Clojure provides several concurrency primitives, like futures/promises, atom, agent etc. | |
;; There is no implementation for "Go channels" in core, but we can use | |
;; 3rd-party library Lamina to do the same things. |