Hacker News new | ask | show | jobs
by giancarlostoro 4013 days ago
My only negativity with Clojure isn't really with the language itself, but with the Debian / Ubuntu packages, they're way outdated. Not sure who ever maintained them, or why they stopped doing so 1.4 being the last version. Outside of that for anyone wanting to check it out, you could try downloading LightTable and using ClojureScript, seems to be close enough I am able to use Clojure books with ClojureScript, not sure entirely of it's differences or how backwards compatible one is meant to be with the other, though I suspect they're meant to be near identical aside from their available libraries maybe.
6 comments

Clojure is often billed as "just another JAR" and in my experience I've never felt the need to install via any package manager. My workflow often consists of a new leiningen project where I define the version of Clojure that I want to use for the current project, along with whatever I else I need for the task at hand. Likewise, if I just need a quick repl to test something out, I'll simply use `lein repl` and fire away.
To expand on this:

If you're familiar with Python Leiningen takes the place of both pip and virtualenv. Every project has a project.clj file where you declare your project dependencies and running "lein deps" from your project root handles it from there. This includes libraries and the version of Clojure you're targeting. When you add/delete/change a dependency in project.clj you simply run "lein deps" again. You never have to run "pip freeze" or make a requirements.txt file because project.clj serves that purpose as well.

As an example, Leiningen's own project.clj: https://github.com/technomancy/leiningen/blob/master/project...

It really doesn't make sense to 'install' clojure the language. Generally one would use apt to install java. Then, you'd download 'lein' the clojure build tool (which does not require a clojure 'install'), and then specify the clojure version in your project.clj file. Lein builds your project and downloads the correct clojure version.

For distributing your app, you just compile it to a JAR, and the user only needs plain old java to run it.

Ah, I see. I never knew 'lein' was capable of doing this. Very useful thanks!
The reason is that nobody (that I know, at least) uses them. The Clojure community uses leiningen, and leiningen takes care of fetching the version of Clojure a specific project needs. There is no point in installing one version of Clojure when the core is small enough that every project can have its own.
Just install "lein" and then in any project run "lein deps" to use maven to pull in all dependencies, including the version of Clojure that you have in your project.clj file.

Clojure is really a simple language to use, which is one reason why I like it a lot (and use it for most of my projects). Compared to Scala and Haskell, Clojure is fast to learn. Java interop with Clojure is also really simple. I often use existing Java code by including it in my Clojure project and adding the magic Java build stuff to my project.clj file. Some purists might like to have just Clojure in their projects, but being able to pull in my old Java code (and other open source libraries) as needed is a large time saver. If Java libraries are small, I like to have them in my project. I use IntelliJ for both Clojure and Java development and having all the code in one place is often nicer than pulling in JAR dependencies.

I am reading several negative responses to this comment and I feel the need to throw him a hand. I like the idea of having a single place where every application is installed, to the extent possible. I like to try to install everything with apt-get, and I feel there is value in working that way.

It's way more complicated to have apt-get for some things, lein for other ones, pip install, quicklisp, the ruby gems, emacs packages, and every other environment reimplementing something that should be possible to reuse.

From the outside, and without researching a lot, it seems that the problem is that authority/responsibility is not easily delegated in the right way.

Perhaps someone can create something like a federated-containerized(contained?)-buzzword-github-like-blockchain-social-aptget-buzzword-thingie. Only half-joking here, but perhaps there's something a la git/dropbox, a product that you don't see coming until you turn the corner and They Just Got It Right. Something created on top of http://ipfs.io , for example, which looks very promising!

EDIT: Perhaps a simpler solution is to enable apt to delegate specific domains to packages marked as package managers, and have them talk through a specified protocol...

One advantage to language specific packages is that IDE's have a uniform target across platforms (PyCharm has pip support for example).

That's a win if you switch around a lot.

Oh, interesting, I've never looked at it that way!
Yup, when they started appearing I didn't like them either but then I realised they have some nice wins as well, who better to package the packages the community produces than the community who wrote them.

    pip freeze > requirements.txt
Has a nice elegance to it as well :).
Not sure where Ubuntu's at but Debian Stable (Jessie) has 1.6 available: https://packages.debian.org/jessie/clojure1.6