Live data from Hacker News

Try Clojure

tryclojure.org

181–190 of 404 posts

Re: Try Clojure

#181
post #79

I'm glad this is back. A version of this existed in the ancient past and helped encourage me to try Clojure which ended up being by far the most impactful decision in my professional life. It went away for a while for reasons I'm unclear on. I use Clojure nearly daily at my job and at home. Sometimes it's standard Clojure, sometimes it's the excellent Babashka flavor which I use as a make-like task runner and Zsh-lik…

As a side note, I'm always amazed by people who can use a highly expressive language (Clojure, Rust, even TS) but switch to Go when they feel like it (especially pre-1.18). To me, switching to a less expressive language is painful and infuriating. I remember having to switch from Python to Java 5, and how everything started to take 3 to 5 times longer code to express. Maybe the key thing is to only write small things…

i find i flip between different languages when i'm thinking about the problem in a different way

an expressive language (clojure, python, C#, etc.) is good when you're iterating "what problem am i even trying to solve?"

a less expressive language is typically better when you more or less know a high level solution to your business problem, and you're iterating on "how do i make the machine actually do it". like "how do i reduce my AWS bill" or "how do i render it in 16ms?"

for something like gamedev, enough of the problem is in the second category that you might not even reach for the expressive language. (many do, though. with lua, or artisanal lisp dialects)

Re: Try Clojure

#182
post #43

> (+ 1 2 '(1 2)) > "3(1 2)" Yup, I'm out.

That's JavaScript for you. Here's a talk about the (in)sanity of JS: https://youtu.be/et8xNAc2ic8 The same under Clojure (on top of the JVM) shall throw a class cast exception.

And the classic “Wat”.

https://www.destroyallsoftware.com/talks/wat

Re: Try Clojure

#183

Earlier quoted context omitted.

Programming without immutability is so painful to me, no matter how many functional features a language adds.

In my experience jumping from a Clojure shop to a large Java shop a few years ago, the benefits of persistent data structures are overstated. Mutable collections are just as good for 99% of use cases. And they're a lot faster (in single threaded code) and occasionally mutation makes things easier. The selling point of Clojure is that persistent data structures prevent several classes of bugs (unintended mutation, loc…

Looking at an object in my debugger back in my call stack and assume I'm looking at the value as it was but in reality it was mutated in a subsequent stack gives me trust issues

It's probably fine most of the time it's just when I have to get into the weeds I want to have stability

Re: Try Clojure

#184

I'm happy with TypeScript, Go, and Rust. Don't feel like learning anything else.

I'm with you. I'll even go a step further, since I haven't heard anybody else say this: My hot take -- There are already too many programming languages in use and every engineers life would be easier and productivity would be higher if we standardized. There is almost no situation where making an entirely new language is the optimal solution. And the worst reason of all to make a language is anything aesthetic (e.g.…

https://xkcd.com/927/

Re: Try Clojure

#185
post #118

Earlier quoted context omitted.

Running on the JVM is one of the best things about Clojure. The JVM is an impressive piece of engineering where uncounted bajillions of man-hours were invested into making a good and performant VM with modern GC. I've been using Clojure heavily for the last 9 years or so and I can't see any reasons to dislike the JVM. Also, I barely ever touch any Java. You don't need to.

And if you do need to touch Java for reasons Clojure doesn’t impose, the interoperability story is really good. I’ve done this with internal libraries - it’s easy to get them pulled into a Clojure code base, wrap them in such a way that the ergonomics of the rest of your code aren’t ruined, and still treat them as a first class citizen for stuff like your build system, artifact stores, etc.

Clojure 1.12 (which is nearly done) is going to add a bunch of interop support - method values, array class syntax, Clojure fn -> Java functional interface conversion, stream support, etc.

Re: Try Clojure

#186
Clojure is becoming popular in Mexico, and I'm guessing Brazil may see a similar situation, because of nubank. It is a popular destination to go work there for computer scientists, and they seem to work mostly in Clojure. I seem to remember they even employed some of the core members of the language? I think at some point they also bought the company of Jose Valim (Elixir's creator), but I think they are still mostly a Clojure shop.

Re: Try Clojure

#187
post #174

So here's something which I, as a Lisper, don't understand: Clojure has syntax for hash tables (the curly braces), why doesn't it use those for let-bindings, instead choosing to use vector syntax? (Of course I prefer standard Lisp syntax which can easily be extended for multiple-value and destructuring bindings: (let ((a 1) ((b c) (list 2 3)) (d e (values 4 5))) `#(,a ,b ,c ,d ,e)) ;; => #(1 2 3 4 5)

Clojure has some very expressive destructuring syntax as well: https://clojure.org/guides/destructuring

Re: Try Clojure

#188
post #83
post #57

If you are new to Clojure and would like to experiment with it in a way that is immediately useful, I highly recommend the Babashka runtime for scripting [0]. It's very fun, approachable, and one of the more polished parts of the Clojure ecosystem. It's a particularly good entry point because unlike full-JVM Clojure it has a very fast startup time. Newcomers can use any file-watching /reloading tools (e.g. nodemon) t…

And when you're ready to take the fun to the web, look no further than Biff: https://biffweb.com

Ah neat. But darn, I was kinda hoping for supporting tools and packages with names like tannen, delorean, doc, mcfly, and strickland ;)

Re: Try Clojure

#189
post #83

Earlier quoted context omitted.

And when you're ready to take the fun to the web, look no further than Biff: https://biffweb.com

Ah neat. But darn, I was kinda hoping for supporting tools and packages with names like tannen, delorean, doc, mcfly, and strickland ;)

It features a time-travel database, if that helps!

https://biffweb.com/p/xtdb-compared-to-other-databases/

Re: Try Clojure

#190

> unlike full-JVM Clojure it has a very fast startup time I can't believe that after all these years Java still didn't fix their startup time.

The JVM cold-starts, loads a Hello, World program from a compressed JAR, runs it and shuts down in 40ms. But Clojure compiles quite a bit of Clojure code generating hundreds if not thousands of classes and then loads them before starting up the Clojure program. Still, there's ongoing work on the JVM (Project Leyden [1]) to speed up both startup and warmup even of such programs by caching more state.

[1]: E.g. see https://spring.io/blog/2023/10/16/runtime-efficiency-with-sp...

Post reply on HN