Created
June 30, 2016 15:29
-
-
Save timvisher/daf70aeea4dfbdac97cc73dbf12298d6 to your computer and use it in GitHub Desktop.
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
🐢 lein try org.clojure/core.async | |
nREPL server started on port 59425 on host 127.0.0.1 - nrepl://127.0.0.1:59425 | |
REPL-y 0.3.7, nREPL 0.2.12 | |
Clojure 1.8.0 | |
Java HotSpot(TM) 64-Bit Server VM 1.8.0_31-b13 | |
Docs: (doc function-name-here) | |
(find-doc "part-of-name-here") | |
Source: (source function-name-here) | |
Javadoc: (javadoc java-object-or-class-here) | |
Exit: Control+D or (exit) or (quit) | |
Results: Stored in vars *1, *2, *3, an exception in *e | |
user=> (require '[clojure.core.async :as async]) | |
nil | |
user=> (defmacro with-timeout [millis & body] | |
#_=> `(let [c# (async/chan)] | |
#_=> (async/go (async/>! c# (do ~@body))) | |
#_=> (first (async/alts!! [c# (async/timeout ~millis)])))) | |
#'user/with-timeout | |
user=> (with-timeout 1000 (println "charnock") 1) | |
charnock | |
1 | |
user=> (with-timeout 1000 (Thread/sleep 2000) (println "charnock") 1) | |
nil | |
user=> charnock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment