Fork me on GitHub

I shared the following in my network, "Clojure - as fast as Java, as productive as Python" A friend came back saying "So is Kotlin". How do I respond to this? It is so hard to explain a LISP to a non-LISPer.


Do you really need to respond to that? I assume that the friend knows Kotlin but doesn't know Clojure, and you're the other way around. It will be really hard to reconcile such different areas.

👍 24

I want to. This is my one shot at making him interested in Clojure. If I say the right thing, that is.


I really, really don't think coming up with a catchy one-liner is a good way to do it. The best way, in the long run, is to make yourself familiar with Kotlin.


I agree with your line of thought. I can't really change someone's mind. Only if I can plant a little bit of curiosity...

💯 4

Clojure is dynamic, data oriented and has a true REPL:

☝️ 4

Many people became curious about Clojure because of Paul Graham, isn't it? And now Uncle Bob Martin.


I will be curious to know from someone who used both Korlin and Clojure.


The regular answer of non-LISP people to that: "Dynamic? Hell no. Data oriented? So is Java - look at those ArrayLists and all those DTO classes! True REPL? I have never needed anything like it, sounds irrelevant."

😄 8

That's true as well.


@U011LEAEURE Thanks! That's a nice video.


I fully agree with @ p-himik.


I think getting them to watch a Rich Hickey talk is probably the best way. If "Simple Made Easy", or "Are we there yet" doesn't spark curiosity, then I dunno if it's worth it


DTO is not data. Java Collections are, but mutable, no destructuring etc. Java and Java libs aren't oriented around Collections the way Clojure is.


The only other way I see is to actually learn Kotlin to a non-trivial depth.


Hah, no way. Noone will watch a 40+ min talk just because I said so.


Really? 40 minutes is nothing, and you don’t need even to be typing. I watched talks while doing dishes (not optimal, you have to rewind with wet fingers many times).


I wouldn't, if I am not interested in that topic already.


I used to work in a place where about 80% of the developers didn't know anything else but Java, maybe some JavaScript. They would never even look in the general direction of something different. Unless, maybe, if it was an direct order from the management. "A 40 (!) minute talk?! I don't have time for that. Go away, let me grind in peace."


I do a lot of Java like Clojure 😋 Streams, maps, collections, lambdas etc. Avoid domain classes, state, mutation... "drag a lot of them about halfway to Lisp"


I make all classes immutable. All params in constructor. No setters most of the time. Only builder classes are mutable. Worked for me for years.


Sure, it's getting gradually better. Alas, so many companies are stuck with legacy projects on ancient Java versions.


I tend not to make domain classes at all. Use maps. Variations of the builder pattern yes, that is the only way to create DSL in Java AFAIK.


How can you not make domain classes? Java Maps require a lot of boilerplate.


Most of the time... query -> maps -> transform via streams -> JSON


Also, you need utility methods for maps to avoid boilerplate... But stream collectors can do a lot.


Unfortunately, Java took the Records + Inline Classes road... It could have been closer to Clojure if they added literals for collections, as Collections creator Joshua Bloch suggested:


Java will probably surpass Kotlin eventually... Clojure is different mindset and experience.


Yeah, I feel Kotlin is mostly syntax sugar, but I am no expert. They have added continuation passing I heard. With Java, the good thing is an IDE can generate most of the garbage for you. But it still hurts readability. Well written Clojure is more readable because it can be so concise.


Recods will have destructuring and you will not have to write equals, hashcode, tostring, constructor, getters etc. Also, they are "immutable" (everything is final). But that is still static and, IMO, inferior to maps.


'Kotlin - as fast as Java, as productive as Java 16'

😆 8

Agree with the general thought that you will not be able to convince anyone of anything 😁 The only way that I went close to adopt Clojure in my Java shop was because my manager was into it. All my enthusiasm went into that but eventually they shut the project down and the code sits to rot in the repositories and now we are back to Java (and Go)


If you want to convince someone of any tool the best way I've found is to make a sizeable Apples to Oranges comparison for something you have to do


its easier to do in kotlin than clojure since kotlin you can just translate existing code and say "hey isn't that prettier"


but to show the benefits of clojure in a way that will rhetorically stick you need to show that the alternative model of programming leads to simpler stuff in aggregate


its important to remember that social and internal pressures will make "why am I using clojure" an active thought for the entirety of a project for most people "talked into it"


Yeah that comparison would never work, I went very very close to get a service completely on me two weeks ago to show how fast I can go with Clojure - that would change minds


I agree with "making them curious" -- if you can't do that, you can't persuade them in any way (in general). There's an element of Blub here: Clojure looks very different to all the languages they already know (no matter how few or how many) so they can't tell from casual exposure whether it's "better" compared to their "home" language.


What worked at our place was for me (the initial Clojure enthusiast) to solve a problem that was well-known to the company and to the other engineers. Then I could show them "here's the solution in X and Y" (existing tech that had been used) and "here's the solution in Clojure". The Clojure code was much simpler and shorter and, because they knew the problem space well and had read the existing solution code, it spiked enough curiosity for them to want to at least try Clojure.


But make no mistake: learning Clojure well enough to use it productively at work instead of existing tech is hard and takes time. So "selling" something as alien as Clojure to individuals (and to especially to companies) is a tough sell.

💯 4

I was lucky because management trusted me to make tech stack decisions for the whole team and they were supportive of training, books, and a period of (much) lower productivity while the engineers cross-trained.


Ultimately, both members of my original team moved on after a few years of Clojure: one to an all-Clojure shop and the other to an all-X/Y tech shop. The former to be fully immersed and avoid our legacy X/Y tech and the latter to get away from the new alienness of Clojure and go back to their comfort zone in X/Y tech.


But folks like us get curious and then excited about Clojure and want to "spread the word" -- and as @UJRDALZA5 has found out, not everyone is as receptive to the word as we might like 🙂

👍 4
eccentric J19:04:20

@UJRDALZA5 I would first think about your friend. Are they asking because of skeptical curiosity or are they just trying to deflate your idea balloon for fun? If it's the former, try responding with a question to ask why they think that. Then you can either reach agreement that both languages do fit that, or you can show examples of how Clojure embodies it more. I think the trick is turn it into a multi-directional, open conversation and not just listing cool Clojure concepts like a soapbox preacher. 😄


Also, if I may suggest...don't go for the "let's have a separate team that proves everybody is wrong" approach. It never works as well 😄


He is a good friend but he likes to stick to his own tools (so am I). @U8WFYMFRU It is the former.

eccentric J20:04:32

In that case I would definitely aim for an open-conversation to learn more about both languages than trying to prove them wrong.

Bill Phillips22:04:17

Kotlin is nifty! It’s hard to win an argument if you aren’t open to other cool things. And there is a lot that is legitimately nifty and great about Kotlin.

Bill Phillips22:04:18

My path to Clojure actually started because I was investigating Kotlin’s coroutines mechanism. I was so burned out on Android client that I didn’t actually want to play around with it, but I felt the need to brush up on it anyways

Bill Phillips22:04:19

that led me to wanting to read up on CSP, which led me to just watch some rich hickey talks, and then I just wanted to play around with clojure because the design discipline sounded so much more fun than the OO hell I’ve been stuck in for so long


I agree that Kotlin is really nice. I try to learn a new language every year or two per The Pragmatic Programmer and Kotlin was the most recent one I picked up I think... I didn't get very deep into it but it impressed me as a "better Java". I think if I couldn't do Clojure, I'd probably be able to survive if I had to use Kotlin 🙂

Bill Phillips22:04:13

kotlin has a lot of the functional stuff that clojure has

Bill Phillips22:04:34

but it doesn’t have the data oriented design or the dynamicism


Apologies for ignoring all the comments above but ‘as productive as Python’ in my opinion is utter exaggeration. When I’m having hard time figuring out things in Python, I turn to Clojure to wind my head off, have fun, solve the problem and get a proper mindset.


Yes, but to someone only familiar with mainstream stuff, I felt Python is a good analogy. Maybe Ruby too, but Python is more popular in my circle.


I think the response should be short yet catchy. Like an elevator pitch. Someone oblivious to the virtues of a LISP will have a very short attention span.


^ Clojure needs a certain level of patience and open-ness to-click IMO. Doubly so for people who don't already "get" what LISPs are about.

👍 8

Yes, I agree. Have you seen Inception? All you have to can do is sow a little bit of curiosity. It may work, it may not. But that's the only way.

eccentric J20:04:28

On a similar topic to hindol, I'm talking to a friend about Clojure as well. It's one thing to say it has a pretty minimal syntax it's another to show it so I created I think that's most of it. Is there anything critical I'm missing?


It may be useful to call out def and defn a little.


I myself found for in Clojure very surprising (it returns a sequence). And loop/recur?


Believe it or not, I did the exact same thing a few months back.

eccentric J20:04:28

Hmm maybe at the bottom I could use defn as an example of how it fits within the syntax described above. My goal is not to show how to use Clojure as there's plenty guides (including yours) for that. I just want to show how structured\consistent the syntax is.


Wow this guide has improved! Did not notice the cool graphics before.


It's the first page of several, walking beginners through the language...


I went through them all but I remember they were not very beginner friendly.


@U8WFYMFRU Maybe let too. Your friend might ask about variables.

eccentric J20:04:21

I was looking at that the syntax guide the other day. For the context of my discussion I want to show how learning a few syntax rules nets you the whole language where as the syntax changes for every type of thing you do in Python.