My thoughts after using Clojure for about a month | Hacker News
| Hacker Newsnew | past | comments | ask | show | jobs | submit| login
My thoughts after using Clojure for about a month (acdw.net)
319 points by speckx 8 days ago | hide | past | favorite | 193 comments https://web.archive.org/web/20260603023617/https://www.acdw.... help
| HiPhish 8 days ago | next [–]
I am now generating this website with ClojureAs everyone knows, you are not a true lisper until you have written your own static site generator.It gave me such a great high with how easy it was to add my own "templating engine" on top, implemented all using macros. The downside is that the crash came hard; there is so much more to a good static site generator such as optimizing the output, supporting scoped CSS, server-side rendering of SPA framework components, and of course integration with the Node ecosystem (for better or for worse there is just so much useful stuff). I have since moved over to Astro. It's still fascinating how far I was able to push my own SSG all by myself though.reply
| embedding-shape 8 days ago | parent | next [–]
Heh, inspired by hiccup, I ended up implementing my favorite Clojure templating library but in Nix, exactly for the purpose of static site generation :) Even have a nifty demo of how it looks for that, it basically looks/works the same as hiccup: https://emsh.cat/niccup/examples/blog/reply
| tymscar 8 days ago | root | parent | next [–]
This is awesome, thanks for sharing reply
| fp64 7 days ago | parent | prev | next [–]
Funny, learning Janet I exactly did that. Was quite a fun experience with the built-in PEG, so I did markdown parsing from scratch. Maybe eventually I will be a true lisper (fell in love with Scheme over 20 years ago but could never really use any lisp professionally. Now I at least do some small things in Clojure and babashka. I love babashka)reply
| acdw 7 days ago | parent | prev | next [–]
Oh I've written an SSG in multiple variations of lisp, as well as sh, make, and most other languages I toy around with. It's been a good "kick the tires" project but I think I need a new one.reply
| tmpz22 8 days ago | parent | prev | next [–]
Yeah integrating NPM is the big one, then you’re whole day converts to recovering from breaches reply
| shevy-java 7 days ago | parent | prev | next [–]
As everyone knows, you are not a true lisper until you have written your own static site generator.I think that part is quite normal. I use ruby for the same purpose, though the only difference is that the code I use is also to be used for dynamic websites at the same time (cgi, rack, sinatra, in theory ruby on rails but I just can't stand rails and DHH these days, so I am in the opposition crowd). Using static websites, though, always feel as if I have significantly less flexibility. I do generate some static .html files as well, but they feel less useful to me, aside from being displayed faster, of course.reply
| Jeaye 8 days ago | prev | next [–]
Once you learn Clojure's syntax and semantics, you're no longer bound to the JVM. There's ClojureScript (JS), ClojureCLR, ClojureDart, jank (C++), Basilisp (Python), babashka (SCI), and many others. This means that, if you don't know Java or don't like the JVM, you can likely use Clojure wherever you already feel most comfortable.For the most part, any Clojure code which doesn't use host interop will work on all dialects. Clojure also has support for conditional code, depending on the current dialect.This is one of Clojure's superpowers.reply
| Hammershaft 7 days ago | parent | next [–]
As someone who loves Clojure, I wonder about the real portability across host languages. Do you have experience with any of these other dialects? (beyond the obvious CLJS & Babashka?)reply
| Jeaye 7 days ago | root | parent | next [–]
I am developing a test suite for portability of clojure.core across dialects. You can find it here: https://github.com/jank-lang/clojure-test-suiteCurrently, we have Clojure, ClojureScript, ClojureCLR, Babashka, Basilisp, Phel, and jank running the test suite.I have only used Clojure, ClojureScript, and Babashka in production. But I am the creator of jank.reply
| rcarmo 7 days ago | root | parent | next [–]
I’d like to say thanks for that - I’ve been using it on my IR version of joker: https://rcarmo.github.io/projects/go-joker/ and it’s been very helpful to pin down bugs.reply
| djblue 7 days ago | root | parent | prev | next [–]
I build and maintain Portal, which runs on multiple platforms including: Clojure, Babashka, ClojureCLR, ClojureScript, nbb, joyride, basilisp and soon jank. The main thing that's different per platform is the os/fs/http/ws libraries but the runtime state and serialization is all the same and reused across all platforms. Also, recently I was able to get most of Portal's reagent viewers, which were designed primarily to run in a browser via ClojureScript, running on the JVM for Server Side Rendering. Clojure is the most portable language I have ever used!reply
| EnigmaCurry 6 days ago | root | parent | prev | next [–]
I am learning Clojure this week, and my test project is a calculator / unit convertor [1]. I wanted it to run in the CLI and on the web, so it targets several hosted platforms: Babashka / JVM / ClojureScript. It's a single code base written in cross platform .cljc files. I already have about 250 tests written for the abstract calculator API, run as a test matrix across platforms, so the project is already in a good place for testing a new runtime.I just learned about basilisp from the parent comment, so I asked Claude to add Python support to the same .cljc files I have, and we finished the port in about 30mins, and then fixed Python specific test cases for another 30 mins, but now all of the existing tests are passing. That's impressive in several ways.Portability is achieved by testing. You have to put the platforms you want to support into your test harness, and the earlier the better. A calculator is purely functional, so this is a fairly straight forward port and really easy to test for. I'm not sure about larger projects, but it seems like there is something seriously right about Clojure's design that makes this easy to do.[1] https://github.com/EnigmaCurry/calcreply
| brazukadev 7 days ago | parent | prev | next [–]
for JS there is also Squint which is a light-weight ClojureScript dialect without the Google Closure Compiler reply
| JBiserkov 7 days ago | root | parent | next [–]
indeed, light-weight means you just add a