Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

University of Helsinki

Functional programming with Clojure

University of Helsinki via Independent

Overview

Functional programming is a programming paradigm where pure functions are the basic building blocks of programs. A pure function is like a function in the mathematical sense. The outputs of the function are fully determined by its inputs. The idea is that this restriction makes your programs easier to understand. This course shows how you can code meaningful programs with mainly pure functions. Pure functional programming differs from object-oriented programming in that e.g. it does not make use of variables or loops.

The course is an introduction to functional programming with a dynamically typed language Clojure. We start with an introduction to Clojure; its syntax and development environment. Clojure has a good selection of data structures and we cover most of them. We also go through the basics of recursion and higher-order functions. The course material is in English.

Clojure is a young Lispish functional programming language on the Java virtual machine (JVM) platform, suitable for small and large programs. Because it runs on the JVM, all Clojure programs can use all the standard and third-party Java libraries freely. It offers tools for many tasks that are harder with other languages and has a special focus on concurrent programming.

You should have basic programming skills. No prior experience with functional programming is required.

The course is based on previous courses given at Helsinki Metropolia University of Applied Sciences in 2012 and at University of Helsinki CS department in 2011, 2012 and 2013.

Syllabus

Basic tools

Get equipped in your fight against the dragons.

  • Installing the developement environment
    • Java
    • Leiningen
    • Editor
    • Git
  • How to submit answers to exercises
Training day

Get your survival skills up to shape.

  • Structure of the exercise project
  • Using the REPL
  • Prefix syntax
  • Defining functions
I am a horse in the land of booleans

Get your horse!

  • if and truthiness
  • Everything is an expression and thus has a value
Structured data

Learn the structural weaknesses of dragons.

  • Local names
  • Data structures
    • Vectors
    • Maps
    • Sets
  • Abstract sequences
    • Mapping
    • Filtering
Style

Polish your boots and armour.

  • Indentation
  • Whitespace
  • Idioms
P-P-P-Pokerface

Project: poker hand evaluator

Predicates
  • Functions as values
  • Predicate functions
  • Higher-order functions
    • some
    • every?
Recursion

Down the rabbit hole.

  • Recursion over sequences
  • Recursion over numbers
  • Nonlinear recursion
    • Tree recursion
  • Passing state
Looping is recursion

Calling tails.

  • Iteration with tail recursion
    • loop
    • recur
One Function to rule them all

One Function to rule them all, One Function to find them,
One Function to bring them all and in the darkness bind them
In the Land of Code where the Off-By-Ones lie.

  • Accumulating recursion with reduce
  • Variable arguments
blorg blorg blorg

A blog engine written in Clojure, studied.

Sudoku

Reviews

Start your review of Functional programming with Clojure

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.