DEV Community

Sean
Sean

Posted on

Learn Clojure Interactively Using eBooks

I recently decided to learn a bit of Clojure. My first step was to setup my preferred editor with a Clojure plugin. The Clojure tooling allows a developer to write code in a text buffer, then use a keyboard shortcut to execute a section of that code in the REPL. This instant feedback makes for a really great developer experience.

After toying around a bit, I bought a copy of Getting Clojure by Russ Olsen from the Pragmatic Bookshelf. One of their download options is PDF format. I read through the first chapter, typing the code examples into a text buffer and using a keyboard shortcut to execute them in the REPL. Typing these examples got a bit tedious, so I started copying and pasting. That's when I got an idea.

If only I could open this book in my editor, then I could just execute the snippets without having to type them.

So, I converted the PDF to a .clj text file using pdftotext (I used the -layout flag for better formatting). Then, I opened the newly converted text file in my editor and was able to execute the code-snippets with a keyboard shortcut. Since this is just a plain-text file, I am able to modify the existing code and try things out with instant feedback. This is a really interactive and engaging way to learn Clojure.

Top comments (0)