This file contains 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
(ns zmq-test.core | |
(:import [java.io InputStream]) | |
(:use [org.zeromq.clojure])) | |
(def *ctx* (make-context 0)) | |
(defn serialize [form] | |
(.getBytes (with-out-str (pr form)))) | |
(defn deserialize [bytes] |
This file contains 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
(ns react-cljs.core | |
(:require React)) | |
(declare render) | |
(defn handle-change [e] | |
(render {:text (.. e -target -value)})) | |
(defn render [{:keys [text]}] | |
(React/renderComponent |
This file contains 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
(ns react-cljs.core | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [om.core :as om] | |
[om.dom :as dom :include-macros true] | |
[cljs.core.async :refer [>! <! chan put! sliding-buffer]])) | |
(enable-console-print!) | |
(def app-state | |
(atom {:counters (into [] (map (fn [n] {:id n :count 0}) (range 10)))})) |
This file contains 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
;; | |
;; Example usages at the bottom of the file | |
;; | |
(defn productions | |
"Returns a sequence of values by repeatedly calling `produce!` until it | |
returns `fin`. The sequence can be used lazily/caching or reducible/non-caching. | |
The arity-2 variant's `produce!` takes no arguments and returns a value | |
or the terminator. |
This file contains 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
;; differences from scheme unfold | |
;; even initial value is lazy | |
;; predicate sense reversed | |
;; internal state == produced value, no special mapper-fn | |
;; no tail-gen | |
(defn series | |
"Produces a sequence of values. | |
`f` is a function that given a value, returns the next value. | |
`continue?` is a predicate that determines whether to produce |