Review and solutions for ‘Clojure Brain Teasers’ by Alex Miller and Lorilyn Jordan Miller - a collection of 25 puzzles that explore Clojure’s quirks and common pitfalls around equality, collections, evaluation, and runtime behavior.
This repository contains notes and examples from working through the puzzles in “Clojure Brain Teasers”. The book explores common misconceptions and edge cases in Clojure around:
- Basics
- Collections
- Evaluation
- Runtime and Library
. ├── LICENSE ├── README.org ├── deps.edn ├── Makefile └── src/ ├── basics/ # Puzzles 1-5 ├── collections/ # Puzzles 6-11 ├── evaluation/ # Puzzles 12-17 └── runtime/ # Puzzles 18-25
flowchart TB
subgraph make["Make Targets"]
direction TB
init["init\n(create dirs)"]
deps["deps\n(install deps)"]
clean["clean\n(cleanup)"]
check["check\n(lint + test)"]
fmt["fmt\n(format code)"]
lint["lint\n(clj-kondo)"]
test["test\n(run tests)"]
repl["repl\n(dev console)"]
build["build\n(full build)"]
docs["docs\n(cover + qr)"]
end
subgraph deps_edn["deps.edn Aliases"]
direction TB
test_runner[":test\ncognitect"]
dev[":dev\ntools"]
clj_kondo[":lint\nkondo"]
cljfmt[":fmt\ncljfmt"]
portal[":portal\nviz"]
coverage[":test\ncoverage"]
deps_graph[":graph\ndeps"]
build_tools[":build\ntools"]
end
subgraph workflow["Development Workflow"]
direction LR
setup --> develop
develop --> verify
verify --> deploy
end
%% Stage connections
init --> setup
deps --> setup
repl --> develop
fmt --> develop
portal --> develop
lint --> verify
test --> verify
check --> verify
coverage --> verify
build --> deploy
deps_graph --> deploy
%% Tool connections
test --> test_runner
fmt --> cljfmt
lint --> clj_kondo
repl --> dev
build --> build_tools
classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
classDef workflow fill:#d4e6f1,stroke:#2874a6,stroke-width:2px
classDef make fill:#e8f5e9,stroke:#2e7d32,stroke-width:1px
classDef deps fill:#fff3e0,stroke:#ef6c00,stroke-width:1px
class workflow workflow
class make,init,deps,clean,check,fmt,lint,test,repl,build,docs make
class deps_edn,test_runner,dev,clj_kondo,cljfmt,portal,coverage,deps_graph,build_tools deps
- Install Clojure CLI tools
- Clone this repository
- Initialize the project structure:
make init
- Install dependencies:
make deps
(org-babel-do-load-languages
'org-babel-load-languages
'((clojure . t)
(shell . t)
(emacs-lisp . t)))
(setq org-babel-clojure-backend 'cider
org-confirm-babel-evaluate nil
org-src-preserve-indentation t
org-babel-default-header-args
'((:mkdirp . "yes")
(:tangle . "yes")
(:comments . "org")))
brew install clojure make git imagemagick ghostscript qrencode gh
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
clojure
gnumake
git
ghostscript
imagemagick
qrencode
gh
];
}
Tool | Purpose | Version |
---|---|---|
clojure | Clojure CLI & deps | 1.11.1 |
make | Build automation | 4.4+ |
git | Version control | 2.39+ |
ghostscript | PDF processing | 10.0+ |
imagemagick | Image manipulation | 7.1+ |
qrencode | QR code generation | 4.1+ |
gh | GitHub CLI | 2.39+ |
Tool | Purpose | Config |
---|---|---|
clj-kondo | Static analysis | :dev |
cljfmt | Code formatting | :dev |
test-runner | Test execution | :test |
portal | Data visualization | :dev |
tools.build | Build tooling | :build |
antq | Dependency management | :outdated |
# Initial setup
make deps # Install dependencies
make init # Create project structure
# Development cycle
make repl # Start development REPL
make test # Run test suite
make fmt # Format code
make lint # Run linter
make check # Run all checks
# Generate documentation assets
make cover # Create book cover from PDF
make qr # Generate repository QR code
# Setup Git hooks
git config core.hooksPath .githooks
chmod +x .githooks/*
{:min-versions
{"org.clojure/clojure" "1.11.1"
"org.clojure/tools.deps" "0.16.1281"}}
Each puzzle includes:
- Original puzzle code
- Solution and explanation
- Additional examples and edge cases
- Related documentation links
This repository is licensed under the Apache License 2.0. See LICENSE for details.