2 ms·
> The primary gain from Lisp and similar is, in my experience, not that it's useful for writing software. It's that learning a different approach teaches you ne
by eyelidlessness 4y ago
> The primary gain from Lisp and similar is, in my experience, not that it's useful for writing software. It's that learning a different approach teaches you new ways to attack problems. Sometimes those are useful.
This exactly describes my experience with Clojure. Sure, I learned “functional programming” which was a “different paradigm”, but at the end of the day what I learned was how to reason about:
1. Whether some bit of state is intrinsic, not strictly necessary but it is highly convenient, or neither of those. (The highly convenient case in Clojure is mostly a reference to Transients[1], which I don’t think I ever used. But the concept has been incredibly valuable when transferring what I’d learned to more imperative languages.)
2. There are correct and obvious function boundaries even for quite a lot of domain specific code, and they usually become evident while you work if the previous point is applied judiciously.
3. Some general purpose abstractions are so self-evidently useful that adopting them is never premature. (Here I’m thinking of what Clojure abstracts as `seq` and the enormous set of functions which operate on `seq`-conforming collection types. Other FP languages similarly bring their own wealth of broadly applicable abstractions.)
4. Many, maybe most, functions have a correct parameter order, which is the order you’d use for true lambdas. Once learned, it can almost always be applied subconsciously.
5. Metaprogramming is good, actually, if you have a good reason to do it. And having a good foundation for metaprogramming is invaluable even if its value is hard to elucidate. (Macros, of course. But I’d give my figurative left kidney to have time to explore the kinds of problems I could potentially solve with Racket’s language-oriented features.)
For another day or at least a later comment, 6. Lack of static types in most lisps hilariously undermines each one of the points above.
1: https://clojure.org/reference/transients https://clojure.org/reference/transients