Hacker News new | ask | show | jobs
by flaie 2228 days ago
> No matter what some people say, getting started in Clojure is a nightmare.

You just need Java installed on your system, then you install clojure (via brew, or sh install) and that's it, you're good to go.

I've written a guide to starting with Clojure covering installation to REPL & IDE configuration: https://grison.me/2020/04/04/starting-with-clojure/

5 comments

This process might seem easy for you, but maybe not for people installing Clojure for the first time.

In an extreme case, someone who doesn't know Java ecosystem might want to stop to research: what is JVM, why is it necessary, which version would be the best, what's the difference between Oracle's Java and OpenJDK, etc...

If you don't know what Java is, you are not in the Clojure target market.
Then they should stop talking about it in /r/Lisp. Nobody there wants anything to do with Java, but Clojurians won't shut up about it.
There is a subtle difference between knowing what river is and knowing how to get to the other bank.
One could say the same for a plethora of programming languages some research is needed and we don't have to resort to extreme cases.

Out of the top of my head:

- There is the Python 2.7/3.X situation still going on, then there are the several distributions of python.

- GNU's R has a similar problem

- Installing gcc on windows was (perhaps still is) a confusing mess for a newcomer.

IMO I did not find installing clojure any harder than installing Scala for instance, and yet I have never heard (anecdotal, I know) complaining about Scala.

The user above mentioned that for _them_ the installation experience of a programming language matters a lot, and that they found the installation experience of Janet superior to Clojure.

You might not share that users preference of caring about the installation experience of a PL, but arguing that this user's preference is somehow unfair because many other languages also have bad installation experiences makes absolutely no sense.

the comparison was to Janet, not Python, R, C or Scala
Isn't GCC on Windows just unzipping a zip file and adding that location to path?
> you install clojure (via brew, or sh install) and that's it, you're good to go

The vast majority of PCs are Windows, not Mac or Linux. Though WSL2 (available with Windows Insiders) makes working with Linux software a breeze, it's not the standard flow. Java isn't installed by default, either.

Your guide suggests using WSL and IntelliJ. Does IntilliJ actually work with Closure running in WSL? For that matter, does the VS Code plugin?

These are all headaches a new programmer won't have when getting setup with PHP, Python, JavaScript or most popular languages.

The Windows story for Clojure is disappointingly weak, especially if you are going by the "Getting Started" section on their website.[0] They have reasonable instructions for Linux and MacOS, but for Windows they point you to an "alpha" level tool.

I think this is especially disappointing because there are mature, cross platform solutions available but whoever manages the Clojure project seems hell bent on pushing their "clj" tool which is, clearly, treating cross-platform concerns as an after thought. The Clojure organization conducts a survey every year and this is hurting their adoption with developers on Windows.

"One new question we asked this year was about the primary developer operating system to give us better guidance about tool-related work. As expected, MacOS was the leader (55%), followed by Linux (35%) and Windows (9%)"

Getting started with Leiningen, in my opinion, is much easier although, as has been pointed out, installing a JDK is an extra step that other languages don't have.

[0]: https://clojure.org/guides/getting_started

[1]: https://clojure.org/news/2020/02/20/state-of-clojure-2020

[2]: https://leiningen.org/

At least lein and boot-clj is available for/via scoop.sh. Seems a bit of a missed opportunity that "official" clojure "clj" isn't just using scoop.
Agreed, the Scoop instructions are simpler and many developers will already have it installed.
I have both a MacBook Pro and a standard PC running Windows, and yes on Windows I run Clojure both on Windows and inside WSL, both IntelliJ and VSCode works pretty well with WSL there's really no problem running it.

I'm doing a lot of Clojure since years both on my MBP and on Windows and there's no problem at all doing that way. Besides VSCode even has a plugin for WSL which will let you directly hook into it.

So yeah there are some questions like which Java to install, which IDE, .. but these questions are the same for other programming languages.

If you have any hint regarding how to improve my guide don't hesitate to tell me if something is not clear in it :)

I'm not familiar enough with Clojure to help (ironically because I myself was put off by the tooling). The reason I asked about WSL and editor issues is because I encountered them myself when working with Elixir on WSL and VS Code and saw related issues on SO about Clojure. This was almost 2 years ago, though.

Probably the biggest thing would be to assume the person reading the guide has a brand new computer and hasn't installed anything yet (including Java and Homebrew).

It's really hard to assume much about the background of someone just trying a new programming language. Maybe they've worked with other languages and you're familiar with, maybe not.

This I think is a fundamental impedance mismatch between Lispers and everyone else.

A Lisper sees a REPL, and thinks they have "gotten started." When I think most language learners don't think they have "gotten started" until they, on the low end, have printed something at a familiar terminal, or, on the high end, pointed a web browser to localhost:8080 and seen some text there.

A lot of tutorials assume the use of lein, which isn't part of Clojure, and isn't properly packaged for windows.
Running the batch file that comes with the project works for me and has worked on a variety of versions of Windows. I haven't had as much luck with the "clj" tool.

I don't see who the "clj" shell script is somehow "part of Clojure" any more than Leiningen or Boot. IMHO it's just a shell script and it works similarly to the other tools, except not in any way cross platform.

Yes but Leiningen is not distributed with Clojure. And as far as I remember there is no installer for Leiningen on Windows. Right now I find it is available through Chocolatey, but the main Leiningen page asks users to download and run a batchfile. That's a very strange instruction to ask a windows user to do: Running batch files downloaded from the internet goes against so much advice on computer security that is given to users.
Neither is clj, for some reason, and it installs the same way as Leiningen. ;-) From their website:

"Then run:

Invoke-Expression (New-Object System.Net.WebClient) .DownloadString('https://download.clojure.org/install/win-install-1.10.1.536....

There's also no clj installer for Windows although there is a Scoop package.

https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Wind...

tried to install Clojure on Windows. Just flat out gave up.
I still feel dreadful when doing all these integration with leninigen. Work for whole month then get it. But there is limit of my personal time budget.

And how to work with vscode as it all fails, at least windows.

But love clojure syntax. In particular I found it hard to see all () and the simple added some syntax sugars help the eye a lot.

Hence jump to janet. In fact the community is very helpful.

Not sure but the size is small enough to see whether one can do embedded as I try picolisp but it is bounded to a low end Env.

Very promising.

Btw the whole point I later schedule more time to try clojurescript to ... May be that can wait a bit.

1 - Download a JVM and make it available on the PATH

2 - Dowload clojure.jar

3 - Start command.com or PowerShell

4 - cd into clojure installation directory

5 - java -jar clojure.jar

Of course, that's not the official instructions. These are the official instructions: https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Wind... - they've managed to work out what the powershell is for "run untrusted shell script directly from HTTPs".

What there should be is an exe or MSI installer like every other Windows program.

The official instructions are here, https://clojure.org/guides/getting_started#_installation_on_...

Not directly the link you provided.

Yes, they require Java knowledge I guess, but then again using guest languages without caring for the host platform is a fallacy.

Now I do agree that an installer would be the right experience to provide.

So according to that page, there are 3 ways to install on Windows.

1. Alpha version of "clj on Windows", which seems to be the recommended approach, and requires going to another page to get the instructions.

2. Homebrew on Linux or Windows with WSL, linked to under "Installation on Linux".

3. Build from source, under "Other ways to run Clojure", which assumes git, Java, and Maven installed, with no instructions on how to install them.

I would say it's pretty confusing from that what is the optimal, recommended way to install Clojure on Windows. It might be better to have subheadings under "Installation on Windows" like "For Java developers" (assuming Java tools already installed), "For WSL users" (Homebrew), "For Powershell users" (clj on Windows). This would consolidate the Windows installation strategies and reflect the diversity in the Windows developer population. Some are already full time Java developers, some live in WSL as much as possible, and some fully embrace Windows specific tools like Powershell.

Where can I get such a clojure.jar? What worked for me was

...

2 - Download clojure-1.10.1.jar, spec.alpha-0.2.176.jar, core.specs.alpha-0.2.44.jar from mvnrepository.com

...

5 - java -cp clojure-1.10.1.jar;spec.alpha-0.2.176.jar;core.specs.alpha-0.2.44.jar clojure.main

Maybe I'm blind, but I don't see any such download link. Or did you use

2 - Dowload clojure.jar

as a shorthand for

2.1 - Install Maven

2.2 - Install git

2.3 - Clone https://github.com/clojure/clojure.git

2.4 - Run mvn -Plocal -Dmaven.test.skip=true package

I wasn't aware of the page update, there has been like two years since I used Clojure last time.

It used to be so that they provided a zip to download.

In any case as mentioned on a sibling comment, I assume that anyone willing to use a guest language should get comfortable with the host platform.

So git, well for better or worse that is what most are using nowadays.

Maven, number one build tool on Java world, even if using another one, most likely those jars are coming from Maven Central.

Just like, regardless of my opinion on C, I keep my C knowledge up to date, because that is what I eventually might need to reach to when on UNIX like platforms.

> 3 - Start command.com or PowerShell

command.com? Is it 1995?

Unfortunately not all Windows shops got the message.
They're (probably) alluding to the fact that command.com is spelled cmd.exe since Windows NT became the mainline.