Skip to content

fbie/parallel-functional-lectures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parallel Functional Programming Lectures

Code and slides (and code for slides) for four lectures on parallel functional programming in Typed Racket and Java. In the Java world, we will also look at concurrency.

Lecture 1: Functional Programming in Racket

Content

This lecture briefly introduces functional programming in Typed Racket. We want to look at persistent data types, such as classical cons-lists and binary trees, and higher-order functional programming, the option type and manual typing.

We will not cover topics such as monads (even though we will look at the Maybe type), lenses and function composition in general. Mostly, we want to get familiar with the, to most of you, unfamiliar syntax of Typed Racket.

Reading Material

Installing Racket

If you are on Ubuntu Linux, you can install Racket and DrRacket via the command line:

$ sudo apt-get install drracket

On MacOSX you can use brew:

$ brew install racket

On Windows, you will have to download the file from the web-site and install it manually.

Lecture 2: Parallel Computations on Immutable Data Structures

Content

Parallel programming is difficult to get right if there is a lot of mutable state involved. In particular, programmers have to decide in advance how they want to distribute work across the available threads.

With modern thread schedulers and the concept of Futures however, we can leave the problem of distributing work to the run-time scheduler. To do so in a functional language, we need to represent arrays in a way that lets us use the scheduler efficiently.

One such way is the Rope data structure. A rope is a binary tree with lists (or arrays) at its leaves. In this lecture, we will look at how to define commonly used operations on container types, such as concatenation, map, zip and fold and how to parallelize those which can be parallelized.

Reading Material

Lecture 3: Java 8 Streams

Content

We will be looking at (parallel) higher order functional programming in Java.

  • Brief review of Java's anonymous inner classes.
  • Java 8 lambda expressions.
  • Java 8 functional interfaces.
  • Higher-order functional programming using lazy streams.

Java 8 streams are lazy, higher-order, declarative programming abstractions and a great tool for data-parallel programming in Java.

Reading Material

Projects

We have a number of practical projects to choose from. You should choose one project in groups of 2 - 3 students, not more and not less.

Hand-in date is 2016-07-13. Please write around two pages of explanations for your solution (in English) and hand them in by e-mail.

You are very welcome to propose your own project ideas, especially if they also involve Java 8 Streams!

Useful Links

About

Code and slides (and code for slides) for the functional and parallel programming lecture at UCAS, Summer 2016.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published