Using datomic with Luminus: Where to put our queries?

June 12, 2019

If we build a Luminus project with db option other than datomic, for example +postgres, the code arrangement is much more straight forward. Open the file resources/sql/queries.sql, and put sql query and sql transaction command in this file. Then, we can just require the xxx.db.core namespace, the db queries or commands are totally available.

Where to put the db queries if we use db option as +datomic?

Continue reading →

Clojure development environment by Vagrant

May 13, 2019

If you want to have a portable Clojure development environment and you use Vagrant, vim-fireplace, you may consider to try my Vagrantfile.

git clone https://github.com/humorless/dotfiles
cd dotfiles
vagrant up
Continue reading →

Using Datomic in my app

April 27, 2019

The background of this post

I began to use Datomic seriously in my project at work from February 2019. Now, it is time to write down certain experience. When I just began, I found a lot of documents talking about how to use Datomic. However, I still found certain points worth to mention from my project.

Continue reading →

REPL tips

March 30, 2019

從今年 2 月開始,接了一個公司內部應用軟體的專案開發,我用 clojure + luminus + datomic 來實作。不知不覺也就每天寫 clojure 的 REPL 近兩個月了。每天玩 REPL 之後,很快就發現一些過去我用 REPL 的盲點。

沒有善用 clojure.repl/pprint

Continue reading →

dependency injection with Clojure

July 12, 2017

寫 clojure 的時候,雖然套用了 REPL-driven development 的開發方式,已經相對可以讓大多數的函數很快地做過測試。但是,隨著要開發的專案愈來愈大,還是一樣需要用標準的寫法來寫單元測試 (unit test) 。有一個非正規的統計,如果是 Ruby on Rail 的專案,一般而言,90% 的函數都是有副作用的。然而, clojure 語言的專案,往往只有 40% 的函數帶有副作用。

即使是寫 clojure 語言,還是會遇到有 side effect 的函數,那比較好的寫法是怎麼樣呢?

Continue reading →