Fork me on GitHub
#beginners
<
2024-03-26
>
Bennet Carpenter16:03:33

I've been building an application with Clojure and really enjoying it. It feels different and powerful in someway that's hard for me to articulate. I was reading https://paulgraham.com/avg.html from Paul Graham that was referenced in this channel recently and he has some high praise for common lisp that feels applicable to Clojure. I've never written common lisp but, it made me wonder, what makes Clojure better (if it is better) than Common Lisp? Or at least, what makes it different? There's the obvious things like the JVM and Node for clojurescript. Anything else?

Alex Miller (Clojure team)16:03:51

https://clojure.org/about/rationale is probably worth reading (+ the other pages in that section) to understand why Clojure is different than Common Lisp and why it's the same. Several of Rich's early attempts did involve integrating the JVM into Lisp or building it in Lisp

phronmophobic16:03:10

First class, builtin support for immutable vectors, maps, and sets is a big one.

ghaskins17:03:24

With the caveat that Clojure is my primary exposure to Lisp and I don’t know Common Lisp; my gut feeling is that beyond the “reach” that JVM/JS host interop brings, as mentioned, there is also a richer set of core data structures and operations (which is what I think @U7RJTCH6J is getting at) that eliminates much of the need to delve into macros. For instance, Paul quotes that his code base was 20% macros, but I would say I’ve never touched anywhere near that ratio coding in Clojure. Of course, declaring that “I don’t generally rely on macros” sounds contrarian to Paul’s point, but I don’t mean it that way. There is power in not needing to do something (in this case, writing more macro code) and yet power in having the option for when I do.

ghaskins17:03:32

Time and time again I have been impressed when I think of something I want to do, and my first reaction is “thats probably not possible”, but then I discover that it is because of Clojure’s power.

Alex Miller (Clojure team)17:03:22

keep in mind that Paul Graham wrote one of the seminal books largely about Lisp macros, so he is maybe an outlier even in Lisp

ghaskins17:03:36

A very good point

hiredman17:03:50

the common lisp standard doesn't mention threads at all, and the jvm has fantastic multithreading

Alex Miller (Clojure team)17:03:59

but yes - fast immutable collections including maps, seq as a list abstraction (largely superseded by transducer invention later), stateful constructs + STM, functional programming, hosted are all important traits of Clojure vs Lisp

☝️ 1
Alex Miller (Clojure team)17:03:04

this is covered in more depth in the history paper too

Nundrum17:03:48

The two things that make Clojure loads better - [] and {} 😉 but that's kind of re-phrasing what others said. There's some kind of magic in bringing vectors and hashmaps so up front. There's also a measure of "visual relief" from not everything being represented by parens. I'd also say the library/packaging situation is easier to understand and the available libraries more feature-rich. I've tried to do some visual projects in other lisps, but never had success like I've had with Clojure.

phill22:03:27

I seem to recall the History of Clojure presented at HOPL also touched on an intention to do some things, in the language and in the organization, differently from Common Lisp.

lspector18:03:41

Rich gave a long talk on Clojure for Lisp programmers early on, which is what turned me from a person who thought Common Lisp was all I'd ever need or want to use into a Clojure user. YMMV but I see that this is on YouTube in two parts, running 3hrs total.