- it's multiplayer! 0 LOC cost
- state is durable! (server side database) 0 LOC cost
- See those pending spinners? We've added a server delay to demonstrate managed load states.
20220817.todomvc.mp4
Electric is a "multi tier" Clojure/Script dialect for full-stack web application development. It uses macros to let you interweave client and server code in a single .CLJC file, so you can define a full-stack frontend/backend webapp all in one place. Electric is designed for rich dynamic applications with reactive user interfaces and complex frontend/backend data sync requirements.
javascript:(function(){ | |
function parseNumber(_txt){ | |
let txt = _txt.split(" ")[0]; | |
let num_clean = parseFloat(txt.replace(",","")); | |
return num_clean; | |
} | |
function asset_name(_txt){ | |
let name = _txt.split(" ")[1]; | |
return name; | |
} |
// We model the call stack using a linked list of Generators | |
// Each Generator has a _return field pointing back to its parent | |
function stepGen(gen, arg) { | |
const {done, value} = gen.next(arg) | |
if(done) { | |
if(gen._return) { | |
stepGen(gen._return, value) | |
} |
(defn create-function-call [param expr] | |
"Create an sexp for calling expr with a first argument provided by a promise. | |
If expr is a list (already in form suitable for a function call), insert the first argument at second position, | |
otherwise turn expr into a function call expression, unless the function is an fn, which is simply returned. | |
println -> (fn [param] (println param)) | |
(* 2) -> (fn [param] (* param 2)) | |
(require '[clojure.spec.alpha :as s]) | |
[:h1 {} "0" 1 [:span]] | |
(s/def :hiccup/form | |
(s/or | |
:string string? | |
:number number? | |
:element :hiccup/element)) |
I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.
Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."