Skip to content

Instantly share code, notes, and snippets.

View seancorfield's full-sized avatar

Sean Corfield seancorfield

View GitHub Profile
@seancorfield
seancorfield / async_pmap.clj
Created July 14, 2016 19:49
pmap using core.async
(ns async-example.core
(:require [clojure.core.async :refer [chan go >! <!!]])
(:gen-class))
(defn my-pmap [f col]
(let [chans (repeatedly (count col) chan)]
(doseq [[c e] (map vector chans col)]
(go (>! c (f e))))
(map <!! chans)))
(ns example
(:require [reagent.core :as r :refer [atom]]
[reagent.cursor :as c]))
(defn input [prompt val]
[:div
prompt
[:input {:value @val
:on-change #(reset! val (.-target.value %))}]])