• ☆ Yσɠƚԋσʂ ☆OP
    link
    01 year ago

    Yeah, I was curious about Lisp for a while, but just couldn’t get into it until Clojure came out. I find the additional syntax for data literals makes a huge difference in readability. Janet takes a lot of the good parts of Clojure and packages them into a nice and small runtime.

    Babashka is another similar project I can highly recommend. It’s a Clojure runtime compiled against Graalvm, so it’s also very lightweight and has instant startup. The nice part with Babashka is how batteries included it is. You have an HTTP server, you can connect to Postgres, parse JSON, etc. all works out of the box. And you can even do REPL driven development against it. You just run bb --nrepl-server and connect the editor to it. For example, here’s a full blown HTTP server that can be run as a script:

    #!/usr/bin/env bb
    (require
      '[clojure.pprint :refer [pprint]]
      '[hiccup.core :as hiccup]
      '[org.httpkit.server :as server])
    
    
    (defn handler [{:keys [uri server-name request-method]}]
      {:body
       (hiccup/html
          [:html
            [:body
             [:p "URI: " uri]
             [:p "server-name: " server-name]
             [:p "method: " request-method]]])})
    
    (server/run-server handler {:port 3000})
    (println "serving on port 3000")
    @(promise)