How to Hire a Clojure Developer in 2018

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.

 

Runs where Java and JavaScript do

Some coders claim that they don’t like Java or JavaScript, but feel forced to use these languages because of their platforms. Clojure and ClojureScript, though, are made so you can use all Java and JavaScript libraries simply and easily. This means that you can have full access to the very large APIs and all of their related libraries.

ClojureScript essentially behaves like Clojure but is able to run everywhere that JavaScript does. Clojure also offers many wrapper libraries and other great tools out of the box, so you can accomplish your desired result with full interoperability with both the Java and JavaScript platforms.

 

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.”

Plus, of course, it uses ClojureScript rather than JavaScript so you can find a Clojure developer to hire that is knowledgeable in this quicker framework.

 

Lisp programming

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

Coding tasks

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))))

 

(defn permutations

    “0(n!) time solution – recursively computing permutations.”

    [s]

    (if (<= (count s) 1)

        #[s]

        (reduce-kv)

        (fn [permutations-so-far idx char]

            (->> (permutations (remaining-subs s idx))

                (map (partial str char))

                (into permutations-so-far)))

            #{}

            (vec s))))

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)

        (cycle)

        (take 21)

        (partition 5 5 (repeat 0))

        (mapv vec)))

 

(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)

         rand-b (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.

(defn- rotation

    “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)))))

 

(defn highest-product-of-k

    “0(nlgn) time + 0(n + (k + k^2)) space solution.”

    [k arr]

    (if (>= k (count arr))

        (reduce * arr)

        (->> (range (inc k))

            (map (partial rotation (vec (sort arr)) k))

            (map (partial reduce *))

            (apply max))))

 

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.

 

Share this post

Hey You!

Learn more about remote recruitment by having our top blog posts delivered straight to your inbox!

Drop your name and email below.

 

By inserting your email above, you confirm that you've read and agree with our privacy policy.

Please check your Email to confirm subscription