Hacker News new | ask | show | jobs
by cgag 4907 days ago
I'm coming from a Clojure perspective (around a year of using it), so maybe some of this stuff is different with CL, but Clojure is incredibly simple compared to C++ and in my experience there's no problem with everyone simply using the entire language.

I've read a decent amount of Clojure source, since documentation is admittedly a problem with a lot of libraries, but it's the language I've found actually easiest to read. The Clojure way of going about things is to pass around and manipulate simple immutable data structures, which I find easier to understand than large class hierarchies. Macros are usually used for creating DSLs or removing simple boilerplate, which leads to smaller, easier to understand code bases in my experience, rather than implementing custom object systems or something like that.

I don't think Clojure really discourages recursion so much as it lets you avoid using it explicitly by providing a good standard library, but many of the standard lib functions are themselves written recursively.

Anyway this was all in response to why isn't it used more. I don't really have a good answer for that, but a lot of it comes to from people being weirded out from its simple syntax, and also not wanting to learn to think functionally. It is being used though, the most successful Clojure example I can think of off the top of my head is Storm, which is usually billed as a Hadoop for realtime processing, and it's being used at a lot of large companies: http://storm-project.net/

1 comments

The books I learnt lisp from emphasised recursion early, and were taught from a perspective of emphasising the power of the language and tricks available to programmers. This approach encourages arcana, similar to bit-shifting tricks you'd find in C books like _Hacker's Delight_ (Warren). Through lisp macros (present in Clojure), you can create your own sub-language.

So merely through the absence of this emphasis on expressive power, Clojure is a bit different. And I think that's great. I might be using Clojure at the moment, except I need to be able to make native builds for the project I'm working on, and so I went with Racket.

Yeah, people are weirded out by the syntax as well. Which is sad, because people who are used to it tend to love it. But if this was the only problem, it could have been easily bypassed decades ago with a whitespace alternative. That is, where developers would be able to denote blocks with python-style whitespace and colons as an alternative to parens. Last time I mentioned this someone pointed me to a distribution of arc that already did it.

    > many of the standard lib functions are themselves
    > written recursively
Maybe the JVM has been updated while I wasn't looking and no longer has a problem with deep recursion. What are some stdlib functions that are recursive?
The JVM still doesn't do tail call optimization but Clojure has a special form, recur, that you can only use in tail position and doesn't use consume stack space. An example: https://gist.github.com/4493547 (loop is like let but works with recur).

A simple one from the standard lib is last: https://github.com/clojure/clojure/blob/master/src/clj/cloju...