Clojure resources

Because much of the work in our group uses the Clojure programming language, I thought it would be useful to post a general list of Clojure resources here, aimed primarily at beginners.

There are many more!

But the intention here is to present a reasonably concise curated list.

Please comment below with suggestions for additions/changes/etc.

Clojure resources

  • Editing and running code: For some workflows you will want to install the command-line Leiningen utility, which can be used to create, manage, and run complete projects (with “lein run”). Several integrated development environments (IDEs) are available. Whichever you use, it is strongly recommended that you make use of the “auto-reindentation” feature, which in some cases requires that a plugin be installed or configured. Recommended IDEs include:

    • IntelliJ with Cursive.
    • Visual Studio Code with Calva. Use Leiningen to create projects. Two key commands: “Calva: Start a project REPL and connect (a.k.a. Jack-In)” and “Calva: Send current expression (or selection) to REPL window and evaluate it”.
    • Gorilla REPL: A worksheet environment that can be useful for certain kinds of experiments of even as a full development environment. The Gorilla REPL site has videos that will give you a sense of how it works, and a section called “Secrets,” with content provided by me, that I think will also help to get you going.
    • Atom with Proto REPL, perhaps following the instructions here (h/t @isja17).
  • Clojure.org, the main site for the Clojure language; note especially their Clojure resources page

  • Clojure cheatsheet

  • Clojure style guide

  • Clojure TV

  • Lee’s tutorial materials:

    • Clojestions, suggested exercises for learning Clojure

    • Clojinc, a saved REPL session intended to support semi-independent learning of Clojure

  • Other tutorial materials:

  • A good free textbook: Clojure for the Brave and True by Daniel Higginbotham. No Starch Press, 2015. ISBN-10: 1593275919, ISBN-13: 978-1593275914. Available free online

  • Tips for using Clojure on Windows

  • Two blog posts on dealing with Clojure error messages (stack traces): 1 and 2

  • Lee’s Clojure GP code:

    • Propeller, “Yet another Push-based genetic programming system in Clojure,” under active development to become a leaner, cleaner and more flexible research platform than Clojush.

    • Propel, a relatively simple, easy-to-understand but nonetheless fully functional PushGP implementation (a fork of @thelmuth’s project) that provided the foundation for Propeller.

    • Clojush, a long-established research PushGP system that has been used for many projects and publications, with a zillion features but also a lot of cruft and unhelpful complexity

    • gp, simple Clojure code for traditional, “tree-based” genetic programming (not Push), which is also explained in this talk

  • Clojure MXNet, for the Apache MXNet deep learning framework

  • Simple Clojure neural network code by Hampshire student Julian Oks

  • When running Clojush programs from command line (and something similar will apply to other GP systems or other long-running Clojure processes), a command like “lein run clojush.problems.demos.simple-regression | tee out” will print the output on the console as well as save it in a file named “out”. The advantage with doing things this way is that you can search for important things in the file using ‘grep’. For example if you want to search for all the lines that starts with ‘Total’, you can use “grep Total out

  • To make Clojush (and other long-running, computationally intensive Clojure programs) run faster, you can use a command like:
    lein with-profiles production trampoline run clojush.problems.software.digits. The output will remain the same.

  • A few of Lee’s other Clojure projects of possible interest:

    • Rock Paper Stuff, a game designed for artificial intelligence experiments and education

    • Pucks, an environment for experiments and education in artificial intelligence and artificial life

  • Quil, a Clojure/ClojureScript library for creating interactive drawings and animations

2 Likes

Calva has been updated significantly. I’ve updated the post above for the new version, but in case it may be helpful for someone, here is the old text which applies to the legacy version:

  • Visual Studio Code with three extensions enabled: Calva, Calva Clojure Formatter, and Clojure Warrior. Also, in VSCode, select Code > Preferences > Settings (at least that’s where it is in Mac OSX), then type matchBrackets in the search field, and uncheck the Editor: Match Brackets setting. This will keep VSCode’s normal (not Clojure-appropriate) bracket matching behavior from fighting with that of the Clojure extensions.
2 Likes