This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-09
Channels
- # asami (10)
- # babashka (11)
- # beginners (24)
- # braveandtrue (1)
- # cider (4)
- # cljs-dev (4)
- # clojure (88)
- # clojure-europe (19)
- # clojurescript (6)
- # code-reviews (7)
- # conjure (2)
- # core-async (2)
- # css (3)
- # cursive (11)
- # expound (81)
- # fulcro (2)
- # hoplon (1)
- # off-topic (42)
- # pathom (1)
- # re-frame (5)
- # shadow-cljs (17)
- # spacemacs (25)
- # testing (6)
- # tools-deps (3)
- # xtdb (12)
https://github.com/idanmel/tic-tac-clojure/ After a couple of years of trying to stick with learning Clojure, I created a tic-tac-toe "game engine". Any feedback would be appreciated. 🙂
One thing I noticed is that your docstrings should be before the function parameters. Anything after the function parameters is evaluated, so each function is actually initializing the string the immediately forgetting about it

A style I prefer is to destructure right in the parameters.. i.e. instead of
(defn f [foo]
(let [{:keys [a b]} foo] ...))
you could just do:
(defn f [{:keys [a b]}] ...)
Instead of This is the only function that should be used from outside this namespace...
, you can use defn-
to make fns private to the namespace.
Also even though this is a pretty contained project and you don't have a lot to gain, on top of replacing most defn
s with defn-
(or instead of it) you can have a separate api
namespace just for symbols that are meant to be exposed to the world
I'd also add some specs and try to use them to validate the user's input (e.g. move
)
to find out if/how I could "reduce" the boilerplate in the turn
function