↖️ Show all posts

clojurescript for the brave! omg 😳

tldr: Code on GitHub
I WANT MORE BRACKETS!


My friends say, I went mad.

A JVM based LISP, that compiles JavaScript for the browser? 🤯
You sure you’re alright?
- the whole world except a few brave men and women out there

First and foremost, I am feeling fine, thank you very much.

To most JavaScript is nothing they would envy one for.
Having the brackets surrounding code 🤯
whoa, this needs to stop!

LISP


https://xkcd.com/297/

JavaScript

And, as the whole web knows, you gotta know your way round types in JavaScript.
The elephant in the room:


https://xkcd.com/1537

So here we are. For an experiment I went brackets all the way. Which are then compiled to JS 🥹

Who would have guessed, it was both delightful and tough to do.

Clojure excels when it comes to logic, data mangling and ease of development. So this was true for most of what I did.

But what did I do exactly? Well, I wanted to see if I could setup an ugly one-page-app that would show events and lets me filter them.

Was it worth it? Absolutely. The data is a real big chunk, so speed was crucial and well, without any optimization (memoization or a lookup table) it turned out usable.

Being all functional, a implemented a basic state engine utilizing clojure’s atom. This was nice. What wasn’t nice was the interactive JS part, but it gave me a nice little practise around event based programming and async promises. I skipped building a more sophisticated bus, it had hurt a little first, but it was absolutely worth it.

I made this little project the most simple way, with the least dependencies possible. Yet, almost everybody else in bracket-land seems to use shadow-cljs (Source)

Code

Go, check out the code. Yes there are brackets, you can grow past that fact, can’t you?

clojurescript-web-app-demo on GitHub


⬅️ Read previous Read next ➡️