Skip to content

Instantly share code, notes, and snippets.

View ztellman's full-sized avatar
💭
boiling the ocean

Zach Tellman ztellman

💭
boiling the ocean
View GitHub Profile
@kachayev
kachayev / clojure-channels-1-generator.clj
Last active October 7, 2015 09:57
Channels-driven concurrency with Clojure
;; 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.
@hiredman
hiredman / join.clj
Created August 22, 2014 01:12
clojure join
;; 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