Clojure is a Lisp that runs on the Java Virtual Machine (JVM).
Learning resources
- Maria a coding environment for beginners.
- nerdy + lanky | The Practice of Clojure Advice for beginners. — ” I highly recommend using a structural editing mode like Parinfer. I avoided code insertion / code completion tools in Ruby, but structural editing is a massive productivity boost in Lisps.”
- JUXT Radar for Clojure
- Getting started with Clojure
- Clojure Docs is a community-powered documentation and examples repository. Very neat looking website. Navigate namespaces and functions to see description and typical usage.
- (another) Clojure Docs — this website is more about tutorials, articles and cookbooks.
- Guide to programming in Clojure for beginners
- Aphyr’s Clojure from the ground up
- 10 minute emacs for clojure guide.
- Clojure for the Brave and True, an Online Book for Beginners — very nice tutorial on emacs.
- Clojure links by Lee Phillips
- Learning Clojure: coping with dynamic typing Sept 2018.
- Clojure Design Patterns
- Clojure Concurrency Tutorial for Beginners with Code Examples by Eric Normand, “In this tutorial, you’ll learn 16 ways for doing concurrency in Clojure including how to start threads and how to communicate between them.”
- Lambda Island | Screencast series about ClojureScript and Clojure
Clojure as a Lisp
Courseware
- Poetry of Programming - Puzzle Based Introduction to Functional Programming | popbook. The Reading exercise (PDF) are great.
Presentations
- The Simplicity of Clojure at OSCON 2014.
- ClojureTV Youtube Channel
- Philly ETE 2016 #2 – Dmitri Sotnikov – Transforming Enterprise Development with Clojure – Chariot Solutions a good demo of lumius framework with a “guestbook app” example (both clj and cljs.)
- The spirit of Clojure by Karsten Schmidt about thi-ng
Clojure like languages
IDE and infrastructure
-
Lightmod — Lightmod is a tightly integrated tool for making full stack Clojure and ClojureScript web apps. It is fully self-contained — no need to install the JDK or any build tool. It hot reloads both client and server code automatically with zero setup.
-
Nightlight is an editor you run inside your Clojure projects. Instead of being a separate application like traditional editors and IDEs, it’s just a library that you add to your project. It spins up a web server and provides a completely browser-based interface to edit your code.
-
CIDER is the successor to nrepl.
-
Cursive Clojure IDE — is an IDE built on IntelliJ
REPL
online playgrounds
- small clojure interpreter playground
- glisp for generative-art. 2020-06-11
Getting started with Lighttable
Basic instructions. I use cmd for the shortcuts below, substitute ctrl on non-mac platforms.
- Install Leiningen http://leiningen.org/ you do not need to install clojure, lein will grab clojure for you.
- lein new playground from the command line to create a ‘playground’ project
- Open Light Table
- ctrl-space woto for “Toggle Workspace tree”
- Add the playground project folder you just created
- cmd-o core.clj to open the main clojure file for the project
- On an empty line type (+ 1 1) and hit cmd-enter
Things will grind away for a while as all the dependencies are downloaded and the JVM starts up. Get a cup of coffee or something. Eventually you’ll see a green 2 show up.
You can then type anything in the tutorial and hit cmd-enter to evaluate it or cmd-shift-enter to evaluate the entire file. Think of the file as a shell with an editable history instead of something you’d want to commit to source control.
Documentation is searchable via ctrl-shift-d or moving your cursor on top of a function name and hitting ctrl-d. Autocomplete is available on tab, you can jump to definition with cmd-. and back with cmd-,
TODO: Explore CIDER + AC(autocomplete) + ritz.
Applications
Libraries
- Clojure libraries I recommend - quanttype Oct 2018.
- Javelin — Spreadsheet-like dataflow programming in ClojureScript.
- Ring inspired by Python WSGI. Primer
- Clojure toolbox — categorised directory of libraries and tools for Clojure.
- boot
- Quil: animation in Clojure
- https://polylith.gitbook.io/polylith/ is a software architecture that applies functional thinking at the system scale. It helps us to build simple, maintainable, testable, and scalable systems.
- Defold - Cross platform game engine written in Clojure.
Spec
- What Spec is; Sep 2020. HN
the biggest win from spec has been with parsing. This completely changes how you’d write a library that takes a data structure and parses it into something meaningful (for example, what hiccup does for html or what honeysql does for sql). In the past, this required a lot of very ugly parsing code and manual error-checking. With spec, you write specs and call s/conform. If it failed, you get a nice error, especially if you pair it with expound. If it succeeded, you get a destructured value that is really easy to pull data out of. I’ve done this in a half dozen different libraries and i’m pretty sure i wouldn’t have even written them without spec.
Mallimalli and specmonstahspecmonstah are my favourite Clojure(Script) libraries built on top of Clojure Spec.
Clojure books
-
Learn to Program the World’s Most Bodacious Language with Clojure for the Brave and True
-
Programming Clojure, 3rd Edition by Aaron Bedra, Stuart Halloway, Alex Miller
-
Practical Clojure by Luke VanderHart, Stuart Sierra
-
Clojure in Action, Second Edition by Amit Rathore et al
-
Clojure Applied by Alex Miller et al
-
Clojure Web Development Essentials by Ryan Baldwin
-
Mastering Clojure Macros by Colin Jones
-
Clojure Data Analysis Cookbook - Second Edition by Eric Rochester
-
Clojure Reactive Programming by Leonardo Borges
-
The Joy of Clojure by Michael Fogus and Chris Houser
-
Elements of Clojure WIP as of Oct 2018.
The first chapter, Names, explains why names define the structure of our software, and how to judge whether a name is any good.
The second chapter, Idioms, provides specific, syntactic advice for writing Clojure which is clean and readable.
The third chapter, Indirection, looks at how code can made simpler and more robust through separation.
The final chapter, Composition, explores how the constituent pieces of our code can be combined into an effective whole.
Clojurescript books
- ClojureScript: Up and Running by Luke VanderHart, Stuart Sierra
- Learning ClojureScript by Allen Rohner, Rafik Naccache, W. David Jarvis
Experience reports and discussions
-
Effective Programs - 10 years of Clojure by Rich Hickey
- “situated programs” (10:30 mark)
- “effective” (around 17:00)
-
Using Clojure in Production | Demystify FP Sept 2018.
-
A Year in Clojure — this article has a nice overview of the many novel features of Clojure. The author is an experienced FP language user (F# etc.,); Oct 2017.
-
Clojure Design Decisions “Rich Already Answered That! A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (Hickey)“.
-
Matthias Nehlsen has good blog posts on clojure+clojurescript applications he has created. He is also writing a book - Building a System in Clojure (and ClojureScript) by Matthias Nehlsen
Articles
- Articles submitted to lobste.rs tagged clojure
Talks and presentations
- CLojure at netflix — good projects to start — “Diagnostic services”.
Tips and tricks
- The Clojure Style Guide
- Readable Clojure @ tonsky.me
- Should I use boot or tools.deps to build command line applications? ClojureVerse ..and this ..via. Seee also frobnicate
Cool projects / Read Code
- thi.ng - computational design tools for Clojure & Clojurescript
- thegeez/clj-board: A drag & drop “kanban board” example with Clojure
- nasa/Common-Metadata-Repository
- BirdWatch
- Inspect Example
- matthiasn/meins: a personal and smart journal
- Systems-Toolbox: Trailing Mouse Pointer Example
Visualization / Notebook
- Gorilla REPL · Gorilla REPL
- metasoarous/oz: Data visualizations in Clojure and ClojureScript using Vega and Vega-lite
Web development
Big data
Blogs
ClojureScript
- dundalek/clojurescript-guide: My notes on ClojureScript
- magomimmo/modern-cljs: A series of tutorials on ClojureScript is one of the clearest tutorials I’ve read.
- ClojureScript — Homepage
- Austin — browser REPL.
- om-cookbook
- ClojureScript Unraveled a book.
- Plank — ClojureScript REPL for Mac
- Transforming Data with ClojureScript
Graal
- This nextjournal notebook has a recipe for building Babashka “executing Clojure snippets or scripts in the same space where you would use Bash.”
Web development
PCP
alekcz/pcp: PCP: Clojure Processor — Like drugs but better
Just use it like PHP on a webserver (say nginx):
#new pcp config => change .php to .clj
index index.clj index.html index.htm;
#new pcp config => change .php to .clj
location ~ \.clj$ {
#default nginx config on digital ocean lemp image
#include snippets/fastcgi-php.conf;
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include scgi_params;
scgi_intercept_errors on;
scgi_pass 127.0.0.1:9000;
}
PCP has following libraries built in:
(require '[cheshire.core :as json]
'[clostache.parser :as clo]
'[selmer.parser :as parser]
'[selmer.filters :as filters]
'[clj-http.lite.client :as client]
'[next.jdbc :as jdbc]
'[honeysql.core :as sql]
'[honeysql.helpers :as helpers]
'[postal.core :as email]
'[clojurewerkz.scrypt.core :as sc])
Learning Journal
- this is a good demo of how to use Clojure’s
-Sdeps
at the command line to execute a script (even one hosted remotely on git):
clojure -Sdeps '{:deps
{hello-clojure
{:git/url "https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202"
:sha "1c9a05106171f97f9b8e8ac8f58c7bd8dbe021f9"}}}'
-m hello-clojure