Live data from Hacker News

Clojure: A Lisp that wants to spread

simongray.github.io

281–290 of 306 posts

Re: Clojure: A Lisp that wants to spread

#281
post #276

Earlier quoted context omitted.

Instead of just measuring how many developers adopt Clojure and how difficult/easy that is, I'd also love a measure of how many developers Clojure "puts out of business". IME Clojure is quite aggressive on that front. In 2017 a customer wanted a set of services written in Clojure. Based on their Java experience they wanted to hire 10 devs. When I arrived they had 4, over the 1.5-year period I was there, they hired an…

I've heard this "mass productivity" claim from Lisp fans multiple times before, and am skeptical. Lisp has been around for about 60-ish years, yet no software house has been able to conquer the software market using it. It doesn't seem to scale to bigger teams and long-term maintenance. Developers can easily create abstractions that fit their own head, but not necessarily other heads. They blame the problems on the o…

Actually quite a bunch of 20 year or older Lisp software is developed in teams.

Cyc is developed by a team since the early 80s. Reduce since the mid 70s. The SBCL and CMUCL Lisp implementations come out of the early 80s. Maxima has its roots in the late 60s/early 70s. The commercial Lisp systems from Franz and LispWorks are developed since the mid/end 80s. ACL2 (a theorem prover used in the chip business) comes from the early 90s. ITA (now Google) started mid 90s. GNU Emacs is from the early 80s. Autocd/Autolisp comes from the early 80s. PTC's Lisp-based CAD system (with a few million lines of Lisp code) must have been originally 2000 or earlier...

Re: Clojure: A Lisp that wants to spread

#282
post #64

The dealbreakers with Clojure for me are: 1. Weirdly irregular syntax. 2. Java import statements and Java error backtraces anywhere you want to do real work. 3. Inexcusable renaming and name collisions on basic Lisp functions. It's much, much less of a Lisp than Scheme and neither "but it's properly functional" nor "we fixed the tooling now" make that any less true or the language any more interesting for the use cas…

>1. Weirdly irregular syntax.

>3. Inexcusable renaming and name collisions on basic Lisp functions.

Given that it isn't a version of common lisp that happens to target the jvm being more superficially similar while actually being substantially different wouldn't be a virtue. It would confuse more than it would illuminate.

Re: Clojure: A Lisp that wants to spread

#283
post #271

Earlier quoted context omitted.

> I do not personally find clojure makes this any easier than in any language. Surprisingly, it does for me. After using many different languages, I find myself more productive in Clojure than in any other language I have used before. Every language I used before Clojure left a dent in my mental ability to appreciate what I do. It's not a single favorite PL of mine, but most other programming languages make me feel b…

I'm a Programming Language enthusiast, currently making my own language. I'm really curious what makes Clojure different - it's pretty much the most loved language among its proponents (i.e. people love e.g. Rust and Go as well, but not as much as those who love Clojure, love Clojure). Is there any very Clojure-y code you can point to, that would showcase it? Is it just the libraries - collections, concurrency primit…

I have started programming when I was about 13-14, so it's half of my life now. Honestly, I never wanted to be a programmer. More of a writer/speaker/culture animator. I found Clojure in my first years of learning programming and, from start, it felt, like the only language that was really thought through, before creation. Clojure is the best because its syntax (or lack of thereof) along with data structures, namespaced keywords, specs, and whatnot, allows me to think properly. No other language gives me tools to think so clearly and plainly. I spent lot of time with JavaScript, some Python, some Ruby, a bit of Haskell. None of those really cares about giving you proper tools to think. When I need to use a language different than Clojure it's a burden now because I still think in Clojure. Or: I try to analyze and build a model of my domain without thinking about computers. The best programming language for that is Clojure. Other languages make you think about computers and, for me, that's waisted time

Re: Clojure: A Lisp that wants to spread

#284
post #271

Earlier quoted context omitted.

> I do not personally find clojure makes this any easier than in any language. Surprisingly, it does for me. After using many different languages, I find myself more productive in Clojure than in any other language I have used before. Every language I used before Clojure left a dent in my mental ability to appreciate what I do. It's not a single favorite PL of mine, but most other programming languages make me feel b…

I'm a Programming Language enthusiast, currently making my own language. I'm really curious what makes Clojure different - it's pretty much the most loved language among its proponents (i.e. people love e.g. Rust and Go as well, but not as much as those who love Clojure, love Clojure). Is there any very Clojure-y code you can point to, that would showcase it? Is it just the libraries - collections, concurrency primit…

I am not an expert Clojurist (yet) but I really love Clojure because it gets out of the way like Python but with the performance of Java. Almost all of the boilerplate is gone, and yes, static types next to each variable feels like boilerplate to me after doing enough Clojure.

Plus Clojure Core Teams laser focus on API stability makes 10 year old (and even unmaintained) libraries to just work. I have not come across a code snippet so far that did not work because of a breaking change, not saying they are not there, but I did not find it.

Re: Clojure: A Lisp that wants to spread

#285
post #271

Earlier quoted context omitted.

> I do not personally find clojure makes this any easier than in any language. Surprisingly, it does for me. After using many different languages, I find myself more productive in Clojure than in any other language I have used before. Every language I used before Clojure left a dent in my mental ability to appreciate what I do. It's not a single favorite PL of mine, but most other programming languages make me feel b…

I'm a Programming Language enthusiast, currently making my own language. I'm really curious what makes Clojure different - it's pretty much the most loved language among its proponents (i.e. people love e.g. Rust and Go as well, but not as much as those who love Clojure, love Clojure). Is there any very Clojure-y code you can point to, that would showcase it? Is it just the libraries - collections, concurrency primit…

REPL driven development

We can develop our program while it's running.

And it's not a tricky thing that injects or restart anything, it's by design. Load file to REPL and now your functions are redefined. Just on this namespace. Load file/reload isn't a automagical thing. It's simple: just "stream" your file to the REPL. HTTP library, DB library, any library need to thing about "how do I hot reload", it's a language feature.

I see many developers arguing things like "types are important because avoid runtime errors". If you develop INSIDE runtime, you have no reason to fear runtime errors. Your runtime error will blow up during development process.

A cool thing about this pieces:

- I can start my app from REPL

- Connect my browser in this app

- Run my integration tests that create entities (inside the same REPL)

- See in the browser the state from app after run the test.

Re: Clojure: A Lisp that wants to spread

#286
post #271

Earlier quoted context omitted.

> I do not personally find clojure makes this any easier than in any language. Surprisingly, it does for me. After using many different languages, I find myself more productive in Clojure than in any other language I have used before. Every language I used before Clojure left a dent in my mental ability to appreciate what I do. It's not a single favorite PL of mine, but most other programming languages make me feel b…

I'm a Programming Language enthusiast, currently making my own language. I'm really curious what makes Clojure different - it's pretty much the most loved language among its proponents (i.e. people love e.g. Rust and Go as well, but not as much as those who love Clojure, love Clojure). Is there any very Clojure-y code you can point to, that would showcase it? Is it just the libraries - collections, concurrency primit…

You model your logic/domain as data using immutable values, and write functions that act on that data. There are a few good things that come from this design decision.

It means you can avoid getting into the situation where half your logic is encoded in the type system and enforced at compile time, and the other half as values at run-time. It's all values at run-time.

And for the same reason, you don't fall into the trap of "puzzle-solving" with a type system. Between run-time values and the compiler there is a world of infinite possibilities that some type systems (and I would also include some macro systems!) seem to encourage adding more and more layers to. Clojure tries to speak the language of data, which is a lot more grounded.

Re: Clojure: A Lisp that wants to spread

#287
post #281
post #276

Earlier quoted context omitted.

I've heard this "mass productivity" claim from Lisp fans multiple times before, and am skeptical. Lisp has been around for about 60-ish years, yet no software house has been able to conquer the software market using it. It doesn't seem to scale to bigger teams and long-term maintenance. Developers can easily create abstractions that fit their own head, but not necessarily other heads. They blame the problems on the o…

Actually quite a bunch of 20 year or older Lisp software is developed in teams. Cyc is developed by a team since the early 80s. Reduce since the mid 70s. The SBCL and CMUCL Lisp implementations come out of the early 80s. Maxima has its roots in the late 60s/early 70s. The commercial Lisp systems from Franz and LispWorks are developed since the mid/end 80s. ACL2 (a theorem prover used in the chip business) comes from…

I don't dispute it has niches where it does well, or at least "works". The implication often given is general purpose productivity superiority.

Re: Clojure: A Lisp that wants to spread

#288
post #271

Earlier quoted context omitted.

> I do not personally find clojure makes this any easier than in any language. Surprisingly, it does for me. After using many different languages, I find myself more productive in Clojure than in any other language I have used before. Every language I used before Clojure left a dent in my mental ability to appreciate what I do. It's not a single favorite PL of mine, but most other programming languages make me feel b…

I'm a Programming Language enthusiast, currently making my own language. I'm really curious what makes Clojure different - it's pretty much the most loved language among its proponents (i.e. people love e.g. Rust and Go as well, but not as much as those who love Clojure, love Clojure). Is there any very Clojure-y code you can point to, that would showcase it? Is it just the libraries - collections, concurrency primit…

The survey answers to Q12 "How important have each of these aspects of Clojure, ClojureScript, or ClojureCLR been to you and your projects?" on the 2020 Clojure Survey results give some summary answers for several features of those languages, how important the people answering the survey finds them to be. https://www.surveymonkey.com/results/SM-CDBF7CYT7/

Re: Clojure: A Lisp that wants to spread

#289
post #287
post #281

Earlier quoted context omitted.

Actually quite a bunch of 20 year or older Lisp software is developed in teams. Cyc is developed by a team since the early 80s. Reduce since the mid 70s. The SBCL and CMUCL Lisp implementations come out of the early 80s. Maxima has its roots in the late 60s/early 70s. The commercial Lisp systems from Franz and LispWorks are developed since the mid/end 80s. ACL2 (a theorem prover used in the chip business) comes from…

I don't dispute it has niches where it does well, or at least "works". The implication often given is general purpose productivity superiority.

Well, you claimed that Lisp programmers can not work in software teams over a long period of time, because they don't understand each others code. I gave a few examples.

There are also a bunch of examples where Lisp was used to prototype or for rapid application development. This enables exploring ideas or conquering early markets. Later iterations may then reimplement the thing... That's another model and is also fine - though there are projects which had not much experience and were not able to get the thing off the ground. For example the first version of the Postgres database was written in a mix of some Lisp implementation and C. This did not work well for them and they switched early away from Lisp. Similar the first version of Reddit was written in Lisp, but it did not really work that well for them and they switched to Python.

> The implication often given is general purpose productivity superiority

I don't think that claim makes sense in general. Much of the productivity in modern software development does not come from the programming language. Much more important nowadays is the general eco-system.

For example it makes very little sense to develop apps for iOS in Clojure, since there is zero support for it from Apple. Thus most iOS applications are written in Objective-C and/or Swift. An assumed 'general productivity superiority' doesn't help at all to compensate the total lack of platform support from the platform provider.

Re: Clojure: A Lisp that wants to spread

#290
post #271

Earlier quoted context omitted.

> I do not personally find clojure makes this any easier than in any language. Surprisingly, it does for me. After using many different languages, I find myself more productive in Clojure than in any other language I have used before. Every language I used before Clojure left a dent in my mental ability to appreciate what I do. It's not a single favorite PL of mine, but most other programming languages make me feel b…

I'm a Programming Language enthusiast, currently making my own language. I'm really curious what makes Clojure different - it's pretty much the most loved language among its proponents (i.e. people love e.g. Rust and Go as well, but not as much as those who love Clojure, love Clojure). Is there any very Clojure-y code you can point to, that would showcase it? Is it just the libraries - collections, concurrency primit…

Being a Lisp is a big one for me for sure! Specifically, this means having a simple regular homoiconic syntax, great support for macros and meta-programming, and most important of all, a fully dynamic nature with REPL driven development and all constructs being reifiable at runtime, while still being fast and performant.

Yes, there are other Lisps, but Clojure also improved certain things compared to them:

- Clojure has way more reach. Being that it runs on the JVM, JS, CLR and has great interop. It means you can actually use Clojure instead of Java, JS and C# to do just about anything you could with those. That's not true of Common Lisp, Scheme, Racket, ELisp, where the main runtimes don't have a lot of money behind them, and where libraries trail behind.

- It disallows reader macros, so there's a limit to how wild people can customize it. This helps minimize the Lisp curse.

- It also has a pretty simple macro system, that is both hygienic, yet straightforward to use.

- It has a more visually pleasing syntax, by extending homoiconicity to also support maps, vectors, sets, regexes and keywords.

- It modernized some old remnants, like having first/rest instead of car/cdr.

- It ditched cons cells, and instead uses a proper sequence abstraction.

- It has proper true/false, and nil is not the same as the empty list.

On top of being a great modern and improved Lisp with bigger reach, it also is just a well designed language. Lets explore some of that:

- Functional programming as the default paradigm, but others are supported (logic, OOP, imperative) when it makes sense.

By default Clojure uses immutable persistent (fast and memory efficient) data-structures and variables are immutable. Functions support full closure over their environment. Anonymous functions are first class. Higher-order functions are included. Loops are handled recursively. The whole shebang. Yet, you can relax this in controlled way when it make sense. You can introduce controlled mutability, you can define polymorphic functions, you can create mutable types, etc.

- Every collection under the sun.

Data-structures are fundamental to computer-science, and Clojure has a bunch of them. Persistent Lists, Vectors, Maps, Sets, Queues. LinkedList, HashMap, ArrayMap, Array, DoublyLinkedList, HashSet, TreeSet, ArrayList, PriorityQueue, TreeMap, etc. All built on proper abstractions as well: Associative, Sequential, etc. And it has a ton of useful functions to operate over them as well.

- Awesome data manipulation constructs

Some people say information systems is all about taking information and transforming/moving it around. Boy does Clojure has you covered there. It has an awesome set of performant lazy data manipulation functions/abstractions called lazy sequences with things like: map, filter, remove, distinct, dedupe, group-by, sort-by, partition, split-at, replace, shuffle, reverse, rand-nth, etc. And, all of these are also available in an eager variant as well which performs loop fusion (called transducers).

- Great equality semantics

In Clojure, equal values are equal things. This is just awesome! Like, that's how a layman thinks of equality, and that's how programming languages should have it as well in my opinion. For performance, you can decide to use reference equality as well, but that's not the default.

- Full support for concurrency and multi-threading

Kind of self-explanatory, but Clojure has a lot of concurrency constructs which make it easy to write concurrent/multi-threaded programs.

- Types are open for extension and have good polymorphic support

A bit like traits and mix-ins, types can all be extended from outside their definitions, and polymorphism exists at many levels: dispatch based on the type of the first arg, dispatch based on the value or type of any arguments, dispatch based on the arity, dispatch based on some hierarchy, etc.

There's more obviously, but this is already pretty long. So I'll finish by answering your last question:

> Do you have any ideas what any other language (e.g. Python, TypeScript, Go, Rust, Julia, Haskell, OCaml) would need to change to make you as productive as Clojure?

Everything. I mean, they'd just need to become Clojure. The thing is, see how long my answer is? That's because it is not just one "killer feature" that makes Clojure awesome. Clojure has just the right balance of features all designed in just the right way to come together beautifully and coherently to create something that is greater than its parts. That said, you can have a look at Elixir, I think it gets closest to providing something that approximates Clojure.

Post reply on HN