174 points · by yogthos · 5y ago · 200 comments
Unfortunately I am too lazy and careless to use Clojure in any serious capacity though. I really need a Haskell or Rust compiler to remind me of all my silly mistakes. I can't be trusted to get to the same level of confidence through unit tests or linting or spec or malli.
I actually tried using Clojure for a little web project (~3k LoC in both Haskell and Clojure) and any refactor that included maps that were passed around in many different routes (think authorization, logging, DB) ended up with me chasing down rather weird type errors. Basically the equivalent of can't call X on undefined in JS.
In Haskell I spent at least the same amount of time trying to make various monads play nicely together. Think using IO, Maybe, Either, etc. in the same route handler without having your code be indented ever further to the right.
But the difference is that once I've invested that time I'm very confident in my code, whereas in Clojure there's always this lingering sense of impending doom because surely there's some code path that I haven't thought about.
Oh, about interactive development: that's sure, CL shines here. Objects get updated (lazily) after a class change, we can install Quicklisp libraries without restarting the image, etc. It's very smooth.
I think most developers cannot be trusted to make these mistakes, I wouldn't call it "careless or lazy". Languages exist with tools baked into them to prevent slip ups. Why wouldn't you want to take advantage of that tooling?
Also, as a result of this comment section, this is the second time in the past week that I've seen the suggestion to use 3rd party typechecking/static analysis tooling in a dynamic language, which (to me) brings up the question: Do you really want a dynamic language, or do you just want the ability to be careless intermittently? There is no shame in saying "I just want to get happy-path code working quickly". There is joy in getting happy path working quickly. I just think, as a codebase in a dynamic language grows, codebases seem to build lots of tooling to make that dynamic language less dynamic.
I think this is getting closer to the interesting questions. It's often a good thing that when the product matures and moves more into maintenance mode, you can then incrementally add the kinds of rigidness that suits the needs of that. Clojure has excellent support for these in the schema style data validation tools of spec, malli, etc.
If you had a rigid system and slow turnaround from the start, you might not have gotten off the ground to get that far.
I always see people say this and on the surface it seems to make sense, but I also always wonder what "rigid system" they're talking about. It's much, much faster to make big changes in every phase of a project in Haskell for me than it is in Elixir, so this is the perspective I'm seeing this from. This hypothetical/straw man "rigid system" is hard to fathom.
Haskell/Rust - Immediately
Java/C#/Go - Relatively quickly
Dynamic Languages - Whenever you decide it becomes important
My dream programming language is basically a statically typed Clojure.
I've on and off poked at trying to make something like that (parsed using instaparse, type checked in Clojure, compiled to C++ using https://github.com/arximboldi/immer for the data structures), but haven't had the time to really get anywhere with it. Plus, even if I succeeded, I wouldn't have the rich Clojure (and by extension, Java and Javascript) ecosystem.
https://github.com/clojure/core.typed
To me, it's one of the great testaments to the power of Lisp that you can bolt on a static type system after the fact.
We'll often do it at the level of namespaces, where a namespace will describe a particular workflow or data transformation, and namespaces tend to be 500 lines or less. It's a similar idea to microservice architecture without the overhead of having to actually split the application up into separate processes.
We'll also often pull out code into libraries when we notice it being generally useful outside the original use case.
I find that there are a lot of benefits to structuring your code using small components instead of monolithically as tt's easier to reason about and reuse. Any large application can, and in my opinion, should be broken down into small parts that are then composed.
Are there any open source Clojure projects that are structured this way? I'd like to see a working example.
I'm not saying this doesn't happen in Java or Go but the static typing enables easier code exploration. That makes code bases more readable to newcomers.
A sort of enforced distinction between (typed) interface and implementation.
In practice I always wound up needing to read code of functions to see what types (or keyword argument!) they expected.
- PHP without phpstan/psalm/phan
All bad ideas, modern tooling can detect errors in your code before you finish your code expression, but you do need to go out of your way to setup it up
Most people do not and then complain about types instead of talking about static analysis
If you are ever coding Clojure you should be following this: https://github.com/clj-kondo/clj-kondo/blob/master/doc/edito...
Static types are a form of static analysis. One that is deeply integrated into the language and compiler, which gives obvious advantages such as machine-checked documentation, custom invariants and error messages (expected a Currency but got a Country), better code generation, better tooling (IDE pop-ups, fast incremental checking) etc. Other forms of static analysis are of course useful too.
It's intermediate representation is statically typed, but the language itself has dynamic semantics.
That said, we have almost every trick and tool up our sleeves that static languages have (in various stages of development). Check out https://github.com/aviatesk/JET.jl if you want static typechecking of julia code.
The most comparison is core.typed, which literally just adds static (gradual) typing to Clojure. That said, I think that's a misleading comparison, and less useful than it is for TypeScript.
If you're willing to relax the definition to "static analyzers that find similar issues to what TypeScript might find", there are a few that require very little input (but are less powerful in finding these types of bugs, more powerful in finding others) like e.g. clj-kondo or spectrum.
One fundamental challenge is that the idea that you should mostly just pass data around, ideally maps, and those maps should be open for extension, is very core to Clojure. You get a lot of benefits from that, but the idea that anyone can add stuff and that's OK also makes it difficult to detect that some accesses are _not_ OK.
(note that Lisp is flexible enough that a type system can be written as a library)
There's also this for run-time checking (i.e., you won't get any help at compile-time, but functions called with bad values will fail in very clear ways): https://github.com/plumatic/schema
As if no dynamic language has ever succeeded in creating enterprise application which runs 24X7 !!!
If you don't like maps use clojure records
If you don't want free floating initiation or ambiguous variables and arguments to function in code, use type hints. Type hints may not be exact alternative but are good enough help in reading the code and especially compiling the code to native graal image or just providing enough information to JIT for optimization.
Use spec for generative testing and more detailed documentation. Irrespective of the language you use, tests are much important than types. Types help but they are not commandments.
Multithreading capabilities in clojure through standard library primitives exposed to achieve it are much better and safer than java.
For most of us, cost of immutable data structure is pretty reasonable. But if you think it's not the case, clojure provides mutable alternatives.
Use components like library to large code in depedancy inversion oriented style, if thats what you like. Personally I prefered dynamic dispatch through multimethods when I used to work in clojure 4 years back.
You can always get the library to do your job in the clojure ecosystem. If you don't find it, clojure provides easy integration with java libraries and you might be able to build a wrapper around it in couple of days if it is complex, in minutes otherwise.
To compare Clojure with languages like Haskell and its features, Rust and its features is utterly naive. Instead development team must strive for what actually is needed for job. Flexibility and discipline provided by language compiler and library eco system will always strike some kind of trade-off. Clojure is good trade-off for most applications including mission critical soft realtime application category.
In my application I was able to get latency for http/rest services less than 15ms which also hit database more than once. Ofcourse it's very subjective to the business use case and networking infrastructure. YMMV
If you really want me to pin point the issue, as far as GC on JVM heap is concerned only major difference with other language implementation was that I had to use around 1GB of extra RAM.
All i am saying is that, start with idiomatic clojure. If that's not performant enough for you use case, start optimizing the code.
_I_ am not capable of writing a robust, large scale application in a dynamic language. I do not have the discipline to second guess everything I do. I will at some point forget to write certain tests. Or test only the happy path. Or make a silly typo. Maybe I'll rename a keyword and in one place not notice that I'm renaming a keyword that will come from a completely different map. Or I'll forgot to namespace keywords and wonder where they come from.
I have no doubt that there are people who can write rock solid stuff in C, or Bash or Dash.
I can't. Therefore, yes, its dynamic nature is what leads me to rule out Clojure. I want to be lazy and focus on the logic, the algorithms and data structures. I do not want to be my own compiler because I'm not good at that.
I fell out of love when I realised what the language is - a mutable, imperative, blocking IO by default language with lambdas and zero guarantees at compile time. Effects happen at any time, as it is an imperative language. Just like JS with a better syntax but with blocking IO and Java threads.
Backends, when more than a handful coders program, turn to runtime checking all the time with spec or schema, and because it’s always up to you to make things async, things often end up depending on a handful of blocking calls. It’s not impossible to write good big programs in clojure, but when working with a group it does not tend to end up that way. Changing a program from sync to async with zero help from the compiler is a task that ends up requiring a lot of time, and negotiation, when it could’ve been the default.
In imperative languages, where you have no control over what effects run, programmers often turn to frameworks to square their program. In teams of >20ppl using clojure, it instead tends to become siloed, where a few people “own” a part of the code, and others must request changes there. It’s not a law of nature, but a pattern I’ve seen emerging in my experience working with clojure teams, including the very famous ones. Time spent negotiating and in these meetings is time wasted.
I should make sure to thank Clojure for getting me into lisp and emacs though, as well as Hickeys enlightening talks.
Imperative? What is imperative by default in Clojure? Nothing. It's one of the least imperative Lisp, favoring functional constructs all over the place unlike Common Lisp or even Scheme.
Blocking IO. Ok. So you want JavaScript? You have async i/o lib for Clojure and the primitive of the language to create threads are relatively good (relative because the limitations come from the Java VM).
Zero guarantees at compile time. Almost true. It' s a dynamic language and does not pretend to be something else. It has pros and cons. Like modelling a domain is very simple since you almost always reuse the same datastructure and having ubiquious immutable datastructures build a solid foundation for an ecosystem of libraries.
All data in Clojure inherits from java.lang.Object. I get what you’re saying, but in real life commercial projects, especially when you use libraries and Java classes, the code ends up with a lot of mutable things. You can never know if any function you call does mutate something without keeping all definitions in your head, and with 20+ people on the project, this is a challenge. Programmers of languages less sexy use frameworks to manage state and effects, but not in FP, which clojurians think they do.
> Imperative? What is imperative by default in Clojure? Nothing.
Please note that I’m not praising Common Lisp or Racket either - the same criticisms apply to them, except they ship with type systems. In Clojure IO is usually done by calling a function that does some (blocking) effect and returns something. That is programming in imperative style. In practice effectful functions find their way into programs, and taints everything referring to it. For this reason, clojure programs written by teams tend not to be as FP.
> Blocking IO. Ok. So you want JavaScript?
I for sure prefer to write a backend where no teammates ever introduce blocking calls. I once worked on a webpage which took minutes to render, because of blocking calls on the back end. It was a mess, after having been worked on for years by around 70 coders, including consultants for the biggest names in Clojurespace.
> Zero guarantees at compile time. Almost true.
Except for syntax errors.
These things turned me off: imperative and blocking IO and effects and no square framework to contain it, combined with zero compile time checks. It results in teams making bespoke solutions that other teams in the company (or even consultants from the famous players in the Clojure space) solving their code needs by meeting with the authors and asking for changes, having a ton of testing to make sure it does not fail in rare code paths, and having one guy on every team religiously adding specs in order to not go mad.
Please note that forcing an execution model in the language will inadvertently cause headaches for some kinds of domains. Since clojure makes no wild choices the language can be ported to other runtimes (.net, js) and benefit from future runtime improvements without breaking the language (JVM virtual threads, value types).
Since the core is small and lisps are extensible, we can have a multitude of choices in libraries. So if you really like typy things you can check out core.typed, spec, schema, malli etc. If you want async you can check out manifold, promesa, core.async etc. If you want non-blocking effects handling you can check out missionary or darkleaf/effect.
It's possible to build a service in a purely functional language using non blocking IO that also takes minutes to render. No language will save you from a bad design.
I do agree that Clojure is not the most suitable language for large projects with lots of contributers because of it's dynamic nature.
Can I ask two related questions -
1. Reading between the lines it sounds like the mutability issue arises from interop, both in the core code and any dependencies that wrap Java?
2. If yes, curious why did the folks involved did not write native Clojure libraries to eliminate the (worst?) blocking dependencies (or patch the Clojure wrapper libs)?
I ask 2 because my understanding is interop was partly a bootstrap strategy for the language and there was always (I think?) an assumption that the native Clojure library ecosystem would grow and make interop less necessary. Is that not happening enough?
From the article I see a lot f reasons why:
> "Don't break things!" is part of the culture.
If you cannot have compile time guarantees on correctness, the discipline to not break things becomes a key feature. On the other hand, if you have strong correctness guarantees, you may more easily incur some breakage (and thus actually fix things).
> Some discipline required [...] with great freedom comes great responsibility.
There's always some discipline required, but without a type system discipline become more important.
> you often need to find specific places where a function or a piece of data is referenced [which is hard in Clojure] because there are no links established via a type system.
Yups. IDEs also like types to build their features on.
> Documentation becomes more important
I dont like documentation as a fix. Docs should tell me why some code is there, not what it does or how to use it (that is preferably obvious).
Again: I like the language a lot. I also like Ruby a lot. But when a new project with serious complexity requires me to pick language I go with something that has: no implicit nulls, strong type safety, sum types, exhaustivity checks.
If you tend to write code once, and come back to it months or years later, breakage is a huge issue - why is the code that was working perfectly well in 2019 broken today? Why do I have to now fix 4 dependencies in order to do what I actually wanted to do (make some small change). This is the reason that I tend to write all my own code in TypeScript projects, but for my Clojure/ClojureScript projects I am much more happy to pull in the occasional library.
I would say that the “don’t break things” culture is less about static vs dynamic types, and more about the style of software being written and the maintenance expectations.
What ever can be checked by the compiler, as part of the language, is automatic free productivity to me.
Which language is that?
Yes, and the result of that is cabal hell. Types aren't there to help you break your API. Once the API is out and it has users it is rude to break them. The linux kernel is a prime example how far can you get if you don't break your users.
I have been working exclusively with Clojure for over 2 years now and I came from mostly C# background and I still want to pull my hair out every time I have to fix a bug which wouldn't have happened in a language with a good compiler. Same goes for asynchronous programming, which I think is generally lagging behind by many years in JVM world.
Another issue I have is the lack of choice in quality third party libraries. A lot of them are created as wrappers over Java libraries and then abandoned and those that aren't usually lack in documentation and depth.
I program compilers nowadays, and do so in OCaml, which is blocking IO, mutable data, and no sexpr, but the type system makes changing code easy. For the domain of compilers, there isn’t much IO anyways.
This is very true. Data-orientation really helps with reuse and library composibility.
The ability to reference git repos in the deps.edn file further supports this process. I don't particularly like the ergonomics of the Clojure CLI, though, but having this feature is pretty great. I use it all the time.
In fact plenty of them, given that there are multiple implementation to choose from.
Meanwhile other languages keep playing catchup and having to rewrite extensions in C.
Every time I use Clojure, I am reminded how much I hate using Java. The error messages alone are enough to turn me away. So is having to set up a whole Leiningen project just to get started.
A Clojure without Java would be very attractive to me.
[1]: <https://www.eclipse.org/mat/about/screenshots.php>
EDIT: A bit more googling and I found <https://memprofiler.com/> for .NET which seems to have a similar feature, called "Instance Graph".
Scala and SBT is a nightmare, I don't want to touch it ever again.
With Clojure you are done before Intellij has even rebuilt your indexes /s.
I personally don't mind it and I love Clojure, but even I have been wondering whether I should port some services to something else because I've had to use larger cloud instances for them simply due to memory requirements... Maybe I can run them on node with Clojurescript instead, I'll have to investigate that, but I think I'll lose out on a ton of libraries that I use that rely on the JVM. Hmm.
Scala is a different beast: modern Java negates the need for a lot of it, and the community tolerance and support for bigots and abusers justifiably distances many.
It is less than 50th position on Tiobe's index https://www.tiobe.com/tiobe-index/ (which is a bit more reputable than LibHunt's)
1. TCO. Using `recur` in Clojure just breaks my thought process. 2. Difficulty in getting down to the metal when needed. Using JNI is painful. In Scheme, when needed, the FFI usually handles plain old C. Much easier in my opinion. 3. Community. Rich is a really smart guy and has made great contributions, but he doesn't suffer fools lightly and I am a fool. Great for a scientist, not so much for a "benevelent dictator for life" of a programming language. 4. Pragmatism over correctness. There was a long running conflict about some set operations that did not return correct results. To my mind, there is no argument against correctness. 5. Slow startup. Not always a problem except when it is. 6. ClojureScript. Could be my unfamiliarity with ClojureScript/JavaScript, but I find I have to revert to JavaScript too often to get something done. And if I can't just use ClojureScript, why use ClojureScript?
Like any Lisp, Scheme is easier to read than Python, Java, JavaScript, Haskell, PHP, Perl, Fortran, Forth, APL, etc. Pascal is pretty good in this regard though. Clojure might actually be better in my opinion.
Why not Common Lisp? It's pretty good and at least as powerful. The warts annoy me though.
So I will continue using Scheme while looking into Janet https://github.com/janet-lang/janet. Janet has most of the things I like about Scheme _and_ Clojure. More experience will tell. I just miss the way maps are handled in Clojure.
As a mathematician I don't need a large ecosystem of other people's work. What keeps drawing me back to Haskell is the experience of reasoning about code paradigms as if they are a branch of algebra (not everyone appreciates algebra, but those who do can never turn around), and a support for parallel code that is decades ahead of any other language I have tried.
I switch between Lisps with relative ease: Scheme, Fennel, Clojure, Elisp, Common Lisp - they feel pretty much the same language. Yes, each has its own oddities and quirks, but I still feel like if I'd discovered some ancient secret - learn it and you start understanding every possible human language. That's how knowing and "breathing" Lisp feels sometimes.
Because Lisp is not a language. It's an idea. An incredibly awesome one. Arguably - the most influential idea in Computer Science. "Once in a millennia" idea.
That's why I never feel anxious about the popularity of programming languages. I don't care what's in the top of RedMonk or TIOBE or whatever else. I don't care if some new programming language gets promoted by the Queen of England, Supreme Pontiff, or Dalai Lama. If it's not a Lisp - it has an expiration date. Lisp, though, will never die.
I prefer Scheme to most other Lisps because of guaranteed TCO, the way continuations are handled, regularity of function names, and define-syntax macros.
Within the Scheme family, I usually prefer Chez for its performance, its FFI and because I happen to prefer an R6RS compliant system at the moment.
Just nuances.
“Lisp” is no more a language family than “curly braces" is. Individual Lisps are often further apart from each other than either from various other languages.
The only relevant measure is: how much actual code do you switch?
Because otherwise that's just like saying "I switch between brain surgery, jazz saxophone, chess and rock climbing with relative ease".
Most of my career has been involved in medical diagnostic, data analysis, and desktop applications. Hobby projects include text processing, editors, outliners, wikis, and knowledge management.
Sadly a lot of people won't even try clojure since it is dynamic typed. I see their point but nevertheless clojure does something really well here. As the author obserserves designing around some core data structures results in high code reuse. A library like spec is also way better in encoding business requirements than all the mainstream language typesystems e.g. a number in business context has mostly constraints like a particular range etc. I really looking forward to see someone come up with a static type system inspired by clojure's approach.
Turing completeness in a type system allows you to use the type system as a meta coding language which is a fantastic amount of string to hoist yourself with, putting meta languages inside languages is a miserable place to be
I'd argue that most people just want the language to check for mistakes, clj-kondo is great and effective at doing this https://github.com/clj-kondo/clj-kondo/blob/master/doc/edito...
If you want types at your system boundaries like on your API then specs or malli is great for that
A great thing that Rich Hickey always advocated is separating out problems and then solving them individually I think modern type systems try and take on too many problems at once, static analysis tools are great because they're uncoupled by time and are laser focused on detecting mistakes only
My hope is yes, in that it's just that the work hasn't been put in yet to create to create the equivalent of Typescript for Clojure or Lua that compiles down to the actual, extensible language.
I always wish that it would become unnecessary to have to choose between stability and extensibility when selecting a programming language. Having a Clojure with static types or a typed Lua (Teal) would put us so much closer to that goal.
https://news.ycombinator.com/item?id=14780381 shows a few errors that provide typo protection, no type declaring needed
https://news.ycombinator.com/item?id=13389287 shows the optimization warnings
https://news.ycombinator.com/item?id=12222404 shows it can even delete unused code thanks to type inference
There's also a handful of attempts to bring stricter type checking guarantees on top as a library, but I haven't experimented with those. I'm very much in the crowd that doesn't find static types very valuable (apart from aiding performance) even for multi-million-line projects, but if I can get a few non-strict warnings like SBCL gives, that's a nice bonus, much like running a concurrent linter for extra warnings in <any lang>.
I liked Clojure a lot, but fell out of love once I realized how much it's still missing from the Common Lisp it was inspired from (non-bonkers OOP, condition system, and reader macros being the biggest to me), and also how its pervasive laziness is something I'd rather opt in to than vice versa. Some people feel the same about its immutability-by-default structures, I don't mind either way. (e.g. I can opt in to them in CL, that's fine, and Clojure's ways of opting out of them aren't bad either.)
If you want to try Haskell, work though a few tutorials and if it looks good, you can grab a free copy of my Haskell book https://markwatson.com/opencontent/haskell-cookbook.pdf There are much better Haskell books than mine though, my book just reflects my own learning process.
If you mean "repl-driven" in a stronger sense, in the sense of a livecoding repl-driven environment that supports building programs by interactively modifying them as they run, then about the only place you find full-featured support for that style of programming is in old-fashioned Lisp and Smalltalk systems. Maybe also in Factor, and arguably in FORTH (though with fewer conveniences).
There's no reason in principle that you can't have a full-featured repl-driven environment for a statically-typed language; I just don't know of any. That's not a big surprise, though. There aren't all that many of them for dynamically-typed languages, either. It takes a lot of work to build one, and the builders pretty much need to know up front what it is they're trying to build, which means they probably need to have seen one before. Most programmers haven't.
Static types aren't particularly an obstacle, but strong immutability is. A full-featured repl-driven livecoding environment wants the programmer to be able to inspect and change anything and everything in the live environment as it runs. Soft immutability is fine; it's okay if you have to say "Mother, may I?" before changing something. Hard immutability is a problem, though. If it's actually _impossible_ to change something, that's incompatible with the nature of a repl-driven livecoding environment. A programmer accustomed to livecoding environments will experience that impossibility as a bug in the environment.
The following is fine therein and statically type checks:
(let ([x (if (condition) "string" (list "a list"))])
(if (string? x)
(string-length? x)
(length? x)))
By process of elimination, because the type of the variable is `(U string? (List-of string?))`, the type checker can prove that if `(string? x)~ be false, the type of `x` must be `list?`, and that `(length x)` succeeds.However, when using a language with a great typesystem, the need for a REPL is just much less. You mostly don't need to try things out because the types guide you. Therefore these languages might have a REPL and it might be useful, but REPL-driven is not really necessary.
> I always wish that it would become unnecessary to have to choose between stability and extensibility
Stability, extensibility, low language-complexity. Pick 2.
Stability - one of Clojure's core tenets.
Low language complexity - not much more than EDN and everything is an expression, plus a few extras like destructuring. Certainly simpler than any other language I have used.
Extensibility - again, one of Clojure's strong points with macros.
As for "Type systems removing the value of a repl" again, I disagree. Repl driven development is as much about exploring the problem than it is writing code.
One language which is explicitly designed to have first-class hotloading support and static types is Mun. It's not production ready, but it was born out of frustration over the dynamically typed nature of Lua while appreciating the benefits it brought to extensibility and rapid prototyping.
For me Lua has the iterative part, but no types. The iterative part makes LÖVE an attractive target for gamejam developers, who don't want to be constrained by compile-restart cycles when they don't yet understand what every aspect of the finished game will look like.
Languages are driven by the platform. There is no Clojure platform that people want to use, so no one uses Clojure.
If a language isn't bound to it's own platform, it can share a platform and displace other tools like python, go, and rust do with C and C++ (docker is go; docker-compose, dnf is python; etc).
Scala has carved out pat of the jvm platform (spark, kafka). Clojure has not.
A common onramp is command line tools, but Hello world in Clojure takes 670ms to run. This is a total non-starter.
time clj -M hello.clj
Hello world
clj -M hello.clj 1.05s user 0.12s system 175% cpu 0.672 total
Without an on-ramp to take over a platform, Clojure will not gain traction. Language quality is not a significant driver in adoption ; that's why shonky R has so many users. They will suffer a great deal to use dataframes and ggplot2.If Clojure is so great, where are these cathedrals that people have made that should make it a no brainer to pick up Clojure? Around what are we circling the wagons?
Scala world is not that functional if you measure it by real-life usage at least. Most of Scala code I've seen was mostly OOP sprinkled with functional tricks.
If you don't want to have to manually compile your app then you can use https://babashka.org/
How many platforms do you think Clojure has?
I've had so many programmers look at code I write and proclaim: "wow that looks impossible because of the parenthesis" and that would never touch anything like it because it seems so different.
Some people do take the time to learn how it works, but many just have a knee-jerk reaction to it and then forget about the language itself.
(-> something (manipulation-of-something) (nextmanipulation) (anothermanipulation))
instead of:
(anothermanipulation (nextmanipulation (manipulation-of-something something)))
Often, you can remove some parenthesis in the first case as well.
I really love this. It is also very easy to just wrap it in a let or a function. This alone should open the eyes of anybody, who has written at least some Shell script somewhere or does some data analysis. If it doesn't, maybe the person isn't actually that great of a thinker or a practitioner and you would be better off around other people professionally. Frankly, who are the people, who cannot grok moving the opening parenthesis before the method/ function? I don't think I have ever met anybody like that - I only read/ hear about such people in comments or at conferences and I haven't heard a name yet.
LISPs forces you to maintain the stack for the parse tree in your head, something humans aren’t that great at — s-expressions are the programming language equivalent of center embedding, which is quite alien for human languages (the depth is three at most: compare that to your favorite lisp program)
Dynamic typing is why I eventually switched. Haskell scratches the same itches that Clojure did, but the compiler and type system are immensely helpful, and keep saving me from tripping over my own feet.
I searched for a Clojure job off-and-on for several years in the 2012-2018 timeframe. I had attended the very first Clojure/conj in 2010 and had development projects in production very soon after that - so I had some Clojure specific experience and was otherwise a reasonable candidate.
My opinion was that there were far fewer opportunities than the inner core of the Clojure dev world admitted. This opinion seems very much not shared or mentioned by others. I also think that Clojure opportunities seem more limited now than a few years ago - Clojure seems to have become one of those programming languages listed on job descriptions but Clojure isn't actually part of the job.
Never getting an offer from a Clojure-oriented job was kind of weird to me at the time because I did get lots of interviews outside of the Clojure world and pretty regular job offers from those. I never figured out why I couldn't catch an offer from a Clojure dev org.
I still have about 10 recruiters a week mail me about jobs relating to Clojure (either Clojure roles directly, or someone looking for a "functional" developer for another fringe language). It's unclear how many of these are the same handful of companies cycling recruiters (or with open reqs). At least in Chicago, it seems pretty straight-forward to get a job hacking Clojure if you have prior Clojure experience.
The other alternative is bringing Clojure to an org. You solve problems and a lot of orgs honestly don't care about the details, particularly if you're in a silo or one of the only devs. This is harder to do in an established org that already has templates for specific things, unless that org is big into containers or microservices already. I've never been hired for a full-time job as a Clojure developer (although I've had offers), but I've put Clojure into production across three organizations.
I am fascinated by the difference between your experience and mine when hunting a Clojure gig.
When I made my comment, I was wondering how quickly someone would make exactly the response you made - no judgement intended. It's been the standard response ("I easily got a Clojure job ... <details>") I have seen for years now.
It is just a very different experience than mine. I would love to have insight into the raw numbers of (devs-who-got-a-Clojure-job / devs-who-want-a-Clojure-job).
I will also second the insight that you can bring Clojure into an org as a problem solver and did exactly that in the early days of Clojure precisely because I was in a mostly silo-oriented organization.
This doesn't work for something brand new of course, but I still do a cursory look through job sites to see what I can see.
Like for instance on Dice.com right now there are 60 jobs available. If I were interested in Clojure today and saw that, I probably wouldn't bother because I know Clojure is mature but there's not a market for it apparently.
Again, this isn't meticulous or scientific at all, just a gut check with a few searches.
Then again, Rust only has 13 jobs listed soooooo.....
For "simple" scripts or server processes that you might call from cron, it was fine. But for web development, it was always so hard to get up and running - get everything configured and then know how to do things - that I always gave up. The Clojure community really values choosing libraries and tools and seems to echew Rails-like approaches. That's good if you know what you're doing, but it makes the cost of entry really high. And for better or worse, Ruby is a pretty nice language and Rails is pretty easy to get rolling with... so it's very difficult to justify the effort of switching. I want to... I really do. But at this point, unless I work for a shop like TFA, it will just never happen for me.
Have you looked into Luminus? I haven't tried it yet, but it's supposed to be a Rails-like starter kit for web apps: https://luminusweb.com/
I think you could probably get code from different chapters from their git repo, but then you're not doing it yourself - you are instead trying to read diffs to understand what's new and figure out why it has been changed.
My experience has been that there is no complete guide, tutorial, or example that is kept current and provides every detail such that you can follow it and learn. I'm sure with enough concerted effort, one obviously can learn it... but there will be some trial and error and some guesswork. Normally that's fine, but it slows the process compared to other tech stacks and their guides.
The Clojure community is nice and helpful, but they're all busy doing real work (rather than teaching). Even the book I mentioned is not yet complete and has been in progress for over two years I think.
I find it somewhat funny that a lot of the critiques here are about purity or types. I really see it as Clojure's core strength that it's both pragmatic and approachable. I'm a math/alegbra nerd, so I love languages like Haskell & OCaml, but they're much more austere for the uninitiated, and have had their own troubles growing. From my experience, the approach of Clojure spec is really nice because it gives you more flexibility/freedom/support in both thinking at a high level about the design of your system (in spec code) before you actually write the (implementation) code itself, while also not requiring it, and letting you add after the fact. You also get a lot for it: generative testing, destructuring, documentation, etc.
That having been said, I'm surprised that more of the pro-type folks here don't seem to be familiar with the [typed clojure](https://github.com/clojure/core.typed) project, which adds optional typing, along the lines of Racket's contract system. To me, it's one of the great testaments to the power of Lisp that you can fairly easily implement types on top of the core language.
My one beef with this article is that scripting with Clojure is now not only possible, but a joy, thanks to GraalVM and [babashka](https://github.com/babashka/babashka)! This has made a HUGE difference in the surface area of problems to which I'm able to apply Clojure.
I'll enjoy reading your production-grade brainfuck code.
A language's built-ins and idioms greatly influence what you say and how you say it. If your mother tongue doesn't have words to describe any emotions you'll have a hard time explaining them. You're talking only about the other side of the coin. Yes, people can write terrible clojure code, you need to be a good programmer to write good code. But please consider rewriting this bash one-liner in pure C (or assembly)
grep FOO */* | wc -l
Having a language to express your domain concisely is essential in reducing code complexity, time-to-market, bugs etc.