Clojurescript with Leaflet
Rene Rubalcava | January 11, 2015
There are some differences between Clojure and ClojureScript, but it's not a stretch to go from one to the other. Here is a handy ClojureScript cheatsheet and you can even try ClojureScript in the browser.
All in one
Although not a requirement, I like to use Clojure to run my local development server. I use Ring-Server with Compojure for routing. I won't go into detail on these, but I also use hiccup as my server-side HTML renderer. If you're familiar with other templating languages, it works pretty much the same way.
Even if you don't know Clojure, you can probably make out the DOM structure fairly easily just by looking at the code above.
On to the ClojureScript
So with that little helper module built, I can move on to putting things together.
You can also see some syntax using let. This creates a local variable for the function. So (let [d (js/Date)]) would bind a new Date object to the local variable d, but it would only be good in that function. You can see it used in the code above to return the map object from a couple of methods so that it could be passed around.
That looks like a lot of trouble
You can find all the code for this sample on github. I even dabbled with using Mapbox with ClojureScript in this example a while ago. I'm a big fan of giving different languages a try and gaining new perspectives in my development, and I encourage you to do the same as well.