Skip to content

Instantly share code, notes, and snippets.

(use 'clojure.core.async)
;this is the function you want to use
(defn lazy-channels [chs]
(lazy-seq (cons (let [ [v _] (alts!! chs)] v) (lazy-channels chs))))
;now for the tesging
(def chs [ (chan) (chan) (chan) ]) ; the channels can come from anywhere, here we are using three channels for testing
@vbedegi
vbedegi / Main.sublime-menu
Created January 18, 2014 11:00
SublimeRepl user config for Clojure C:\Users\your-user-name\AppData\Roaming\Sublime Text 3\Packages\User\SublimeREPL\config\Clojure\Main.sublime-menu
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
@vbedegi
vbedegi / react-sortable-hoc-in-reagent.cljs
Last active November 29, 2017 15:50
using react-sortable-hoc in reagent
(def react-sortable-hoc (aget js/window "deps" "react-sortable-hoc"))
(defn make-sortable-element-component [wrapped-component]
(let [sortable-element-factory (.-SortableElement react-sortable-hoc)]
(-> wrapped-component
r/reactify-component
sortable-element-factory
r/adapt-react-class)))
(defn make-sortable-container-component [wrapped-component]
@vbedegi
vbedegi / elm.cljs
Last active April 29, 2019 08:15
elm in cljs
; util
(defn tag-dispatch [dispatch tag]
(fn [msg]
(let [tagged (if (vector? tag)
(conj tag msg)
[tag msg])]
(dispatch tagged))))
; counter