Hacker News new | past | comments | ask | show | jobs | submit login

It's great to see such an "exotic" programming language like Clojure getting some serious traction. And by exotic I mean a language that stands out from the imperative or object-oriented crowd.

I like how Clojure challenges established paradigms with a surprisingly mature ecosystem.

Being a hosted language on the JVM has its pros and cons, but the cleverness and pragmatism of Rich Hickey (creator of Clojure) really stands out. He decided to go with an industry strong, battle-tested environment, effectively standing on the shoulders of giants, while providing a lot of fresh ideas.

Also, the fact of being a Lisp can be seen from different angles: for some it's lots of weirdly nested parentheses, for others it has a beautifully simple, yet extremely powerful and expressive syntax.

But don't let those aspects fool you. Once you scratch a little bit the surface, you will see the extraordinary power of its persistent data structures. For those who don't know what persistent data structures are: in Clojure, oversimplifying, there is no mutation to data structures. Every time you "add" or "remove" a key from a hash map, you are actually creating a copy of it. And in order to make this efficient, you need special data structures with "superpowers", that are not actually creating a whole copy of themselves, but rather modify atomically only a part (hint: trees).

And having those data structures leads to the next big feature of Clojure: concurrency. Not only does Clojure provide a mechanism to dispatch thread-like constructs (core.async), but the whole language is designed around supporting concurrency.

I also want to add that what really surprised me about Clojure is its thriving community and smart people using it. I am pretty sure that if you want to hire great, highly motivated talent, going Clojure will help you with that.




Parentheses is no a problem if people really want to fix it. We already have JavaScript fixed with CoffeeScript, there's also a chance to fix Clojure with indentation-based syntax, like I tried

https://github.com/mvc-works/parser-combinators/blob/master/...


> Once you scratch a little bit the surface, you will see the extraordinary power of its persistent data structures.

I've heard this repeatedly, yet in the examples I've read (for web servers and for web ui work with cljs), they're using atoms with `swap!` to provide "current state".

Could you provide an example of using persistent data structures in a web app? Or am I mis-understanding?


You're compare-and-swapping out persistent values with an atom (it holds a succession of immutable values over time). It's not an example of people shirking persistent data structures for mutation.


Yes, I understand that. I guess my original question would have been better put: can the notion of "current state" be avoided with persistent data structures, and if so, how?


I'm a hardcore imperativist right now, so don't take this as authoritative, but here's my understanding of how that works:

Think of your data as one reality in the set of all possible realities. None of them exist or don't exist, they'll just receive human attention or they won't. Instead of an inbox with an ID and a current state, you just store events that happened and a user might say show me the end state of the timeline that started at event d79se5k. They might also ask you for the timeline starting at a different point.

There's no "current state". You're just ready to answer questions about hypothetical realities. And while some realities are more likely to be computed (and cached) that's only because they correspond to some key facts that a human is going to look up.

Put another way, imagine a soup of unrelated facts. Your code is a way to project those facts into different mathematic spaces. You never just say "what's the current state" you have to actually write out specifically what you mean as a query.

Sorry for the vagueness. I'm just putting out there my fuzzy understanding until someone else can write something better. :)

I'm really interested this approach, and I think a lot of data should be immutable. Sadly, a lot of people are treating immutability as a religion these days, which causes problems when computation is better suited to imperative structures.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: