Clojure: atom vs agent vs ref

2017-10-06
阅读 2 分钟
2.5k
First atom, agent and ref are work for mutable state and threads. Atom It is synchronous, and will retry when other thread change the state. Use case: memoize. Functions for agent: atom, deref, @, swap!, reset! Agent It is asynchronous. It has :error-handler, and :error-mode. when validate failed...

Elasticsearch debug

2017-06-26
阅读 2 分钟
6.3k
倒腾一个新东西,首先是要了解基本概念,之后就是要学习如何 debug 。要不然很容易出现抓瞎的情况。搞定这两点剩下的就是耐心和恒心的问题了。

Understanding Clojure Ring Middleware

2017-04-20
阅读 3 分钟
2.9k
我们看到,handler会接收一个request参数,并返回一个hash-map,hash-map包括headers、status和body,这个hash-map就是一个response。党我们访问 [链接] ,就会看到 Hello word!