The workshop will be conducted over two days.
We will go over installation on IDEs and setup of development environment on all attendees laptops. We’ll use NightCode which should work out of the box on most OSes.
Once NightCode is setup, one can download this repository on their machines and open it in NightCode. The directory contains a file called bridge.clj which can then be opened up with the InstaREPL feature of NightCode. InstaREPL automatically evaluates every expression in the file on the left-hand pane. This file has some very basic opening content that one can evaluate, we’ll build upon it as we go through the lessons.
After installation, we will go over the following topics on the first day:
- What is programming
- What is Clojure
- Why did we choose Clojure
- Taster into a few Clojure things on the InstaREPL
First off, we will have the teachers do a quick double check for everyone’s IDE and REPL setup from last evening.
The second day will be crash course in Clojure. We will divide the day into two parts - learning and doing.
In the learning section, we will go over the basics of Clojure in a presentation style while doing exercises as we come across them in the REPL. We have broken down the content into the following chapters:
- Understanding the REPL [10 mins]
- Syntax, or the anatomy of an s-expression [15 mins]
- Simple data types - string, bool and numbers (infix vs. prefix notation) [20 mins]
- Special data types - symbols and keywords (introduce def) [20 mins]
- Functions (built-in fns, def, fn) [25 mins]
- Sequence / Collection types and associated functions [30 mins]
- Context and bindings (let) [20 mins]
- Control flow and logic (if, when, do) [20 mins]
- Composition of functions [15 mins]
This section will start with one common first Clojure program written by all together - drawing lines in Quil. Quil is a simple and powerful DSL for drawing and creating interactive animations.
The instructions for creating the first program are here.
Once everyone is comfortable with writing a basic Quil program, we will break into smaller groups with one or more teachers per group and solve the Mars Rover exercise in Quil
A sample solution is provided here. It is structured and commented inline in a way where it starts from basic building blocks to the final solution. This solution is a work in progress as of now, but will be done in a couple of days.