Skip to content

alain-picard/clojure-training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clojure-training

A set of training materials prepared by Alain Picard for use in training new clojure engineers at Blue Ridge Global.

How to use this repo

PREPARING

Before each lesson, you must come prepared by having completed the necessary reading in each of the Lesson Plans. Make sure you keep an eye on this repo for new lesson plans, and I will email you all each time a new one is added.

DURING THE LESSONS

This repo will periodically be updated with the code developed in each lesson (when applicable) so you can download and play with the examples I provide during the lessons. Jack will also record the lessons and make the videos available to you all. After each lesson, the code will be added in a file (or subdirectory) named lesson-01, lesson-02 etc. (in the src subdir).

AFTER THE LESSONS

You will have to fork this repo so you can submit your assignment solutions for review.

At the end of the lesson, I will sometimes set assignments which I will detail in the Assignments section. You should attempt to answer these, placing your answers in the file /src/assignments/your_name//lesson_XX_answers.clj. When you can cleanly load your file into a repl, raise a pull request for me to review your code and merge it back into the main repo. Thus, you’ll be able to view your colleague’s solutions after I merge your answers back into the main repo.

REVIEWING ALAIN’S SOLUTIONS

After the lessons, I will place my solutions in this directory. You can peruse them at your leisure and compare against the code you have written.

I will also place the code I present during the live coding sessions in here; the files beginning with live_XXX are the code you see on the screen during the presentation; the files without the live_ prefix are the preparatory material I produce (which is close, but doesn’t include the tangents I go off on during the lessons as questions arise, etc.)

Material we plan to get through, eventually

  • [X] how to get help
  • [X] navigate sources
  • [X] structural editing
  • [X] using maps
  • [X] gotchas with conj
  • [X] destructuring
  • [X] sequences, lazy seqs
  • [X] lexical vs dynamic scoping
  • [X] reduce, functional idioms
  • [X] tracing, debugging
  • [X] writing tests
  • [X] Introduction to leiningen, dependency management, and finding and using libraries in clojure.
  • [X] The philosophical underpinning of state handling in clojure
  • [X] vars, atoms, refs, agents
  • [X] threads, futures, promises (concurrency primitives)
  • [X] The reader, it’s syntax, and brief macro overview
  • [X] java interop, definining new types
  • [X] namespaces, the ns macro
  • [X] i/o
  • [X] writing (good!) docstrings
  • [X] metadata
  • [X] strings; regexes
  • [X] throw/catch, slingshot
  • [X] making simple HTTP requests
  • [X] multimethods
  • [ ] finding and using libraries
  • [ ] supply a list of recommended good libs.
  • [X] reader syntax
  • [X] Simple HTTP service: ring handlers, libraries
  • [X] core.async
  • [X] clojurescript
  • [ ] reframe
  • [ ] macros, threading macros

Resources

We are going to make extensive use of the following:

Recommended external links

I urge you all to have a look at:

Lesson Plans

Lesson 1
intro
Lesson 2
Functional Programming
Lesson 3
More functional programming
Lesson 4
References and identities, threads
Lesson 5
Java interop, namespaces, i/o
Lesson 6
Clojure odds and ends
Lesson 7
Building a simple HTTP service - Guess the right number!
Lesson 8
core.async and Dynamo DB
Lesson 9
Clojurescript
Lesson 10
Re-Frame
Lesson 11
The word puzzle (part 1)
Lesson 12
The word puzzle (part 2)
Course summary
A quick review

Assignments

Lesson 2

These are the assignment problems following Lesson 2. We will discuss your solutions and see Alain’s solutions at the beginning of Lesson 3.

  1. Implement your own version of filter using a loop form, then using reduce.
  2. Implement your own version of update-in
  3. Write a function which solves this problem: http://www.4clojure.com/problem/77
  4. Write a function which solves this problem: http://www.4clojure.com/problem/53

Lesson 3

  1. Read chapters 9 and 10 of Clojure for the Brave and True
  2. Listen to the this online talk: Are we there yet Take notes! Listen carefully! Rich is a very deep thinker. Pay particular attention to the analogy about the baseball game, when he discusses how state evolves and should be modelled. Can you see why clojure has atoms and refs, and immutable values, as its programming model?
  3. Try to solve the best poker hand problem. This will require you to first solve problem 128, recognizing poker hands. This is an excercise is structuring and factoring your code as cleanly as possible; pay close attention to your representation and clearly separate the parsing code from the evaluation code. See what reusable functions exist in recognizing all the various types of hands.

    Here I want you to think not simply in terms of learning clojure syntax; (you should have all the necessary tools to solve this already), but at the next level of sophistication; that is, worry about

    • choosing good names for functions and variables
    • representation of your data structures
    • clearly separating out functionality
    • making things as readable and understandable as you possibly can
    • write a test harness for your code.

Lesson 4

  1. There are no koans dealing with multiprocessing (probably just too hard to write them!) So we’ll be doing the book excercises instead. Do the exercises at the end of chapter 9.
  2. Do the exercises at the end of chapter 10. Note that in the second excercise, the URL shown is incorrect; it should be HTTPS, not http, thus:
    (slurp "https://www.braveclojure.com/random-quote")   
        

These exercises are longer and more challenging than the ones you have done so far. Don’t hesitate to reach out on the issues board!

Lesson 5

The assignments are now located in the lesson plan file. See Assignments.

Legalese

Copyright © 2020 Alain Picard Consulting.

I wrote and assembled this for didactic purposes, and I’m perfectly happy for anyone to use this as they see fit.

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

About

Training material for new clojure programmers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •