How to Hire a Clojure Developer
Clojure can be used for a multitude of different projects, most commonly web development. Although it’s not the most popular language, it attracts top talent, so there are many reasons that you’d want to hire a Clojure developer.
Clojure aims to be a general-purpose language that you can use, typically, in the same way that you use Java. It’s functional, although not rigidly so, instead of being Object Oriented like many popular languages used today.
According to their website, the best reasons to hire a Clojure developer are because it:
Embraces an industry-stand, open platform - the JVM
Modernizes a venerable language - Lisp
Fosters functional programming with immutable persistent data structures
Provides built-in concurrency support via software transactional memory and asynchronous agents
Let’s look a little more in-depth about the reasons that you should look for a Clojure developer to hire.
Immutable data structures
Clojure gives its developers many data structures out of the box like vectors, which are like resizable arrays, sets, linked lists, and hash-maps.
Each of these structures are immutable, which means that an instance cannot be altered after the constructor for that object has completed execution, although Clojure works a little differently. If you hire a Clojure developer, they should understand that this language implements these immutable data structures in the form of a tree that can all share unchanged nodes.
This assists in both memory and time efficiency. Additionally, this helps you and your Clojure developers avoid crashes and unintended bugs.
Has its own version of React.js - Om
ClojureScript has its own version of React.js called Om. While web developers appreciate the way React.js renders web apps, Om takes it one step further.
Using ClojureScript’s immutable data structures and “by representing the Virtual DOM with an immutable object, diffs can be computed efficiently by checking references, not values, and so Om runs that much faster.”
If you hire a Clojure developer, chances are, they love that Clojure is a Lisp, the second-oldest high-level programming language that is still commonly used today.
Lisp source code consists of lists, so programs that utilize this language can “manipulate source code as a data structure, giving rise to the macro systems that allow programmers to create new syntax or new domain-specific languages embedded in Lisp.” If you’d like more info on Lisp’s core values, check out this essay by Paul Graham.
With this Clojure being a Lisp, although not a Common Lisp, you can have a high consistency of syntax and utilize live coding to help solve bugs or other issues in your code. Being structured as a lisp, you can select exactly what you want to analyze more deeply.
Clojure, additionally, is a Lisp that is “not constrained by backward compatibility.” It extends the code-as-a-data paradigm to maps and vectors, has core data structures that are extensible abstractions, and defaults to immutability.
Now that you see a few of the benefits that this language offers, let’s take a look at some interview questions to ask before you hire a Clojure developer.
Best Clojure Interview Questions of 2017
If you want to hire a Clojure developer, you need to make sure that they aren’t just an expert at the theoretical questions, but that they also know how to do some common coding tasks.
Write a recursive function that generates every permutation of an input string and returns them as a set
With this question from Interview Cake, your potential developer doesn’t need to spend their time focusing on efficiency; instead, it’s meant to see if they can write this code with Clojure. Assume each character in the input string is unique and the function is allowed to have loops, as long as it is also recursive.
Let’s take a look an example solution to this code:
(defn- remaining-subs [s idx]
(str (subs s 0 idx)
(subs s (idc idx) (count s))))
“0(n!) time solution - recursively computing permutations.”
(if (<= (count s) 1)
(fn [permutations-so-far idx char]
(->> (permutations (remaining-subs s idx))
(map (partial str char))
Keep in mind that this is just one solution, but not the only possible solution as there are different ways of accomplishing the question. If you don’t want to worry about trying to interview for a developer in a language you don’t know or understand, let us find you a highly-vetted expert so you can get straight to work.
There is a pre-existing function rand5() that generates a random integer from 1 to 5. Use it to write the function rand7() that generates a random integer from 1 to 7.
This commonly asked interview question is meant to simulate a 5-sided die then becoming a 7-sided die. It makes sure that your developer knows how to write code correctly in the language of your choice, that they have substantial logic skills, and that they can incorporate pre-existing functions, perhaps created by another team member or before they came on-board, to the desired result.
The first method already returns each integer with equal probability, and rand7() must do the same.
Let’s take a look at a sample solution:
(defn- random [floor ceiling]
(+ floor (rand-int (inc (- ceiling floor)))))
(defn- rand5 
(random 1 5))
(def ^:private rand7-matrix
(->> (range 1 8)
(partition 5 5 (repeat 0))
(defn rand7-with-matrix 
(loop [row (dec (rand5))
Column (dec (rand5))]
(if (and (= row 4) (> column 0))
(recur (dec (rand5)) (dec (rand5)))
(get-in rand7-matrix [row column]))))
(defn rand7 
(loop [rand-a (rand5)
(let [out (inc (+ (* (dec rand-a) 5) (dec rand-b)))]
(if (<= out 21)
(inc (mod out 7))
(recur (rand5) (rand5))))))
Find the highest product you can get from any three integers in a given list of integers
The last coding task that we’ll look at that you should ask before you hire a Clojure developer is relatively simple, but it confirms that they have a solid grasp of the logic of Clojure as well as how to properly write it.
The input list_of_ints that we’ll use in this given example will always have at least three integers, so your potential coders won’t have to test for this outlier.
“Rotates bucket of k length around the bottom and top of arr by idx.”
[arr k idx]
(let [top (- (count arr) (- k idx))]
(vec (concat (subvec arr 0 idx)
(subvec arr top)))))
“0(nlgn) time + 0(n + (k + k^2)) space solution.”
(if (>= k (count arr))
(reduce * arr)
(->> (range (inc k))
(map (partial rotation (vec (sort arr)) k))
(map (partial reduce *))
Find a Clojure developer to hire
Clojure is a coding language that is complex to learn but can have great results if you hire a true expert. To cut through the difficult part and hire a Clojure developer that is guaranteed to be skilled and valuable to your business or project without needing to search for and vet them yourself, we’re here to help.