clojurescript Getting started with clojurescript

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

ClojureScript is a version of Clojure that compiles to javascript code and runs in the browser.

While it is mostly the same as Clojure, there are a few differences (mainly, it lacks some api calls that invoke java functions that are not available in javascript)

Installation or Setup

Leiningen

Note: If you're going to use Leiningen, you first need to download and install JDK 6 or newer.

The easiest way to get started with Clojure is to download and install Leiningen, the de facto standard tool to manage Clojure projects.

Linux:

curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/bin/lein
export PATH=$PATH:~/bin
chmod 755 ~/bin/lein
lein

OS X:

Follow Linux steps above or

Install with [Homebrew]:

brew install leiningen

Windows:

See https://github.com/technomancy/leiningen#installation.

Connecting to a REPL

Once you have lein installed, execute

lein repl

Start a new ClojureScript Project

lein new mies myproject
cd myproject
./scripts/build
 

Now open index.html in a Web Browser.

Press F12

Look at the Console, and observe the following:

Hello world!
 

Acknowledgements

  • David Nolen's extraordinary work on ClojureScript.


Got any clojurescript Question?