Skip to content

Instantly share code, notes, and snippets.

@tbatchelli
tbatchelli / core.clj
Created July 26, 2013 23:27
Sieve of Erastothenes as a data-flow using core.async (http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)
(ns sieve.core
(:require [clojure.core.async :as async :refer :all]]))
(defn counter-stream [n]
(let [c (chan)]
(go
(loop [i n]
(>! c i)
(recur (inc i))))
c))