HomeMathEmailBlogGitHub

ClojureScript

2023-08-08

ClojureScript is dialect of Clojure that compiles to Javascript. This makes it possible to create websites with Clojure. My latest story is to modify my TicTacToe game to compile to ClojureScript. To easily use the different types dialects of Clojure together, I need to make my Java-dependent files have an extension of .clj, my ClojureScript files have an extension of .cljs, and my universal (can be used by any dialect) files have the extension .cljc

This is easier said than done. While writing my original Clojure code, I didn't think about how or when I used Java interop. Eventually, though, I was able to isolate board-state, game-state, move, and utils into .cljc files. This should be enough to manage state in my ClojureScript build. The only thing I didn't isolate which would be beneficial is my menu file. It uses Java's Date class which I could delegate to my database implementations since that's where it is actually used.