RoyalZSoftware
Back to Blog

This is why I recently tried Clojure

Alexander Panov 2023-06-24 2 min read
This is why I recently tried Clojure

I am coming from a mixed software development background. Starting with VB.net, when I was a child, over to Java for a long time, ending with Ruby, Javascript / Typescript.

On my whole journey, I did not get in touch with functional programming a lot. I furthermore did not spend a lot of my years with declarative programming. That's something I have been up to for the past few years.

Difference between imperative and declarative

const arr = [1, 2, 3, 4, 5];
 
// imperative
let itemsArr = [];
for (const item of arr) {
  itemsArr.push(`Item-#${item}`);
}
 
// declarative
let itemsArr = arr.map((item) => `Item-#${item}`);

What is Clojure anyways?

It's a Lisp-like functional programming language. It runs on top of the Java Virtual Machine. Key features include:

What does it look like?

(def arr [1, 2, 3, 4, 5])
 
(map #(str "Item-#" %1) arr) ;; Same example as in javascript

Why did I do this to me?

Good question. I still haven't found a good answer to that one. I was heavily interested in whole new paradigms, that are outside of my horizons:

I have furthermore seen an amazingly funny presentation about Clojure.

%[https://www.youtube.com/watch?v=jlPaby7suOc]

Who is using Clojure

Nubank.com.br. A Brazilian bank runs fully on Clojure microservices. They state they have over 1000 microservices in use.

Was it worth it?

Somehow, yes. It taught me new ways to approach a problem and showed me, how f*cked I am once possible solutions get a new requirement: immutability.

Conclusion

Would I recommend getting your head around Clojure? Well if you have some spare time and want to learn a new language, then it has served me well.

I highly recommend you, to watch the talk mentioned above.

More articles

Building a Web Server in Go: A Beginner's Guide

Building a Web Server in Go: A Beginner's Guide

Oleksandr Vlasov 2024-11-26 3 min read
React Hooks — createContext, useContext, useMemo

React Hooks — createContext, useContext, useMemo

Oleksandr Vlasov 2024-10-23 4 min read
Mastering Git Rebase Interactive: Squashing Commits for a Clean History

Mastering Git Rebase Interactive: Squashing Commits for a Clean History

Alexander Panov 2024-10-21 2 min read