Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
-- ln -s ~/repos/config/init.lua ~/.hammerspoon/init.lua | |
-- Global variable for the Command Mode | |
cMode = hs.hotkey.modal.new({}, "F17") | |
-- Global variable for Delete Mode | |
dMode = hs.hotkey.modal.new({}, 'F20') | |
-- Global variable for Select Mode | |
sMode = hs.hotkey.modal.new({}, 'F19') |
-- A global variable for the Hyper Mode | |
k = hs.hotkey.modal.new({}, "F17") | |
-- Trigger existing hyper key shortcuts | |
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end) | |
-- OR build your own | |
launch = function(appname) |
(ns ui.form | |
(:refer-hoplon :exclude [select input textarea label form]) | |
(:require [ui.form.input :as input] | |
[ui.button :as button] | |
[ui.modal :as modal] | |
[ui.grid :as grid] | |
[ui.filters :as filters] | |
[ui.link :as link] | |
[ui.util :as util] | |
[ui.icon :as icon] |
(defn throttle [c ms] | |
(let [queued? (atom false)] | |
(with-let [ret (cell @c)] | |
(add-watch c (gensym) | |
#(when-not @queued? | |
(reset! queued? true) | |
(with-timeout ms | |
(reset! queued? false) | |
(reset! ret @c))))))) |
alan@alanputer:~/Desktop$ tree | |
. | |
└── jars | |
└── upcase-2.0.0.jar | |
1 directory, 1 file | |
alan@alanputer:~/Desktop$ boot repl | |
nREPL server started on port 50498 on host 127.0.0.1 - nrepl://127.0.0.1:50498 | |
REPL-y 0.3.5, nREPL 0.2.8 | |
Clojure 1.6.0 |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.