Skip to content

Latest commit

 

History

History
186 lines (108 loc) · 10.4 KB

study-guide.md

File metadata and controls

186 lines (108 loc) · 10.4 KB

Clojure Study guide

A suggested study guide for those new to functional programming with Clojure.

Hint::MeetAMentor Clojure Study Group - 3rd November 2018 onwards

MeetAMentor Community is hosting a Clojure Study group starting 3rd November, using this study guide. Sign up via the MaM Study Group form.

All broadcasts are available via the jr0cket YouTube channel

Week1: Overview of Clojure

youtube live recorded broadcast

Briefly discuss what the Clojure programming languages is good for, some example companies using Clojure and give suggestions on how to start learning Clojure.

Cover the syntax and a few common functions,

Homework

Week2: REPL Driven Development overview and ClojureBridge London exercise review

youtube live recorded broadcast

Discuss REPL Driven Development (my blog post on the topic)

Review the ClojureBridge London exercises homework - Github Gist - Repl.it project

Homework

Week 3: Using the REPL and Structural editing

youtube live recorded broadcast

Part 1: Structural Editing

The first part of the video covers Structural Editing for Clojure development and the concept of code as symbolic expressions. Demonstrating the basic of structural editing using Spacemacs

Briefly covers the different editors that give a good Clojure experience. http://practicalli.github.io/clojure/development-tools/

Visit http://practicalli.github.io/spacemacs to learn more about Clojure development with Spacemacs (Emacs and CIDER).

Part 2: 4Clojure exercises 1 to 15

At 34.50 onwards we discuss solving the first fifteen challenges of 4Clojure, a website that gives you Clojure code snippets to complete. Entering the missing code and the website will run the code and tests, showing if you got the answer correct.

Solving the first 15 challenges - 34.50 onwards

Homework

Clojure Loves Data: A 40 minute sessions at London Java Community conference

youtube live broadcast

Live coding session covering the basics of using data structures (collections) in Clojure, mostly focusing on Vectors (arrays) and Maps (hash-map, dictionary). I will also attempt to broadcast live a lightning talk on how to broadcast live (because I like being quite meta some times).

Week 4: Clojure maps, ascii code generator and clojure test

youtube live broadcast

Working with Clojure maps (hash-map) and writing a simple ascii code generator.

Homework

Week 5: Test Driven Development - Clacks messenger

youtube live broadcast

This week we will look at Test Driven Development and Clojure.

The clojure.test library is part of Clojure and is the simplest way to start with TDD and Clojure. We will take a small challenge and solve it by first writing a failing test, then writing some code to make the test pass, then refactor the code if necessary.

We will start by creating a new project on the command line with Leiningen, which creates parallel source and test branches.

lein new my-project

Open the source code file from the project (SPC f f) and start the REPL - , ' or M-RET.

Toggle between source code and test code with SPC p a. Or open the other in a new window using SPC p f, highlight the filename and use C-c o to open in new window.

Run all tests using , t a or M-RET t a.

To automate running of tests, toggle cider-auto-test-mode using , T t and then evaluate either source or test buffer using , e b and tests will run for that namespace

Source code examples

Homework

Week 6: Advent of Clojure

youtube live broadcast

Solving day one of the Advent of Code challenges. The first part of the problem is solved with a simple reduce function. The second part we investigate several different approaches, becoming more functional and using higher abstractions in Clojure.

If you understand the progression of the solutions, you are a good way on to creating very clean Clojure code at a good level of abstraction.

Note::Advent of Code

jr0cket/advent-of-code-2018 repository contains documented descriptions of the solutions to Advent of Code created so far.

Advent of Code is a yearly coding challenge that sets one challenge per day, just like an advent calendar.

Tim Pote will be live streaming their solution to the advent of code each day at 12 noon (UTC-5 timezone) on Twitch.

Borkdude also has a Github repository where advent of code solutions will be published, with all solutions checked with Clojure spec

Week 7: Simple website with ClojureScript, reagent, bootstrap and SVG

youtube live broadcast

Creating a very simple front end website with ClojureScript. ClojureScript is Clojure that runs on JavaScript engines, such at the one in your browser or node.js. The project included reagent, a react.js style framework for ClojureScript. The web page is made up of one or more components that are managed by the reagent library, so if there are updates to the components the reagent library will refresh the web page.

The project also used Bootstrap as a Cascading Style Sheet library, to help structure the layout of the page and add visual components. The reagent library also lets us define graphics using markup, creating Scalable Vector graphics.

The project was created with the Leiningen figwheel template, to give instant feedback in the web page as we update the code.

lein new figwheel simple-website -- --reagent

Week 8: 4Clojure challenges 16 to 22

youtube live broadcast

Solving the 4Clojure challenges from 16 to 32.

Hint::4Clojure challenges up to 15

We solve the first 15 challenges in study group #3 from 34.50 onwards

jr0cket/four-clojure repository - discussions of 4Clojure solutions

Week 9: Tic-Tac-Toe

youtube live broadcast

Building a simple command line tic-tac-toe game in Clojure in a very functional style.

No frameworks were harmed (or used) in the making of this broadcast 😸

Hint::Joining the Live discussion

A hangout link will be posted to the MeetAMentor Slack channel and London Clojurians meetup page about 30 minutes before broadcast.

Additional concepts to cover

  • Understanding how to model the world with immutable data (values)
  • Writing your own (pure) functions
  • using sequences
  • lisp comprehension
  • higher order functions
  • functional composition.

Homework: various small challenges and 4Clojure exercises.

Resources for practising Clojure

Demonstrate how to use the REPL in Spacemacs and Atom.io with ProtoREPL. Demonstrating evaluation of code, structural editing, refactoring, etc.

Hint::Finding your own learning path

As there are many ways to study, please feel free to carve out your own learning path and share what you found useful if you wish. Learning Clojure section describes important steps you should take on your journy into Clojure.