Hjertnes.blog

Clojure method naming: ? and !

September 14, 2018

Some clojure methods ends with either a ! or a ?. This is one of those tiny details about Clojure that I really dig. Because that single character tells me something really important about the function.

Every method that ends with ? is a predicate. This means that it returns true or false. nil? empty? blank? are examples of predicate functions.

The functions that ends with a ! is a little bit more complicated. All of them are inpure functions. They usually mutate state or deal with io. These are the kind of functions you want to avoid unless you have to.

Clojure and editors

September 13, 2018

I have played around with many different setps for developing Clojure over the last year. Some I like, others I don’t.

This is about the three setups I prefer. There are many others, that you might like more.

All of these setups have their problems, and I don’t consider any of them perfect. But they work fine.

  • VS Code + Calva
  • IntelliJ + Cursive
  • Emacs + Cider

VS Code with Calva is a good setup. The repl is easy to set up and use. And Calva makes sure the remote repl you are connected to refresh your files on save. But there is one thing I do not like about this setup, and that is that console messages(some of the error messages) don’t show up inside VS Code.

Cursive on the other hand is a very easy to use and solid setup. You get everything you expect from a IDE setup. The repl is solid and easy to use, you can either set it up to run a repl for your or connect to a remote one. Like VS Code you don’t get all the output if you connect to a remote one. This is not a problem if you run it locally in IntelliJ. Unlike Corva, Cursive does not have support for reloading changes on save, so you need to run a keyboard shortcut each time you wish to do that. Not huge, but a little bit annoying.

The Emacs setup is my favourite. You can configure everything, you have many different ways to do everything you want. Everything from how you wish to test out code in the repl to what output you want access to. I have not set this up yet, but it is possible to set up auto reload like VS Code.

I personally prefer Emacs for Clojure development, because it is the most powerful. But it is also very hard to get into. If you are the kind of person that would enjoy emacs, you already know it. If not, check out Code or Cursive.

Use Code if you are more into text editors, and Cursive if you are more into IDE’s. Also take the issues with each setup into consideration for what setup you pick.

If I don’t use Emacs, I often use Cider when I want to see all repl output, while I use Code when I find it cumbersome to reload the code all the time.

OmniFocus 3

September 12, 2018

Tags. We finally have tags.

I never really got perspectives, and contexts in OF 1 and 2. Or I understood them, but I never found a way to use them together in a prodctive way that made sense to me.

It took me a minute to get into perspectives with OF3.

My favourite thing about how tags are implemented though, is that you can use them like me as a flat structure, or like people used contexts in the past.