Functional programming is not an infallible system. One still has to test programs for possible faults and to trace the causes of any faults that are found. Conventional approaches do not work well in the context of lazy evaluation and higher-order functions, motivating the development of new methods and supporting tools. In these lectures we focus on two such: QuickCheck for testing and Hat for tracing.
Functional programming is largely concerned with two things, trees and types; and XML is a notation for writing trees and types. XQuery is a query language for XML designed by the World-Wide Web Consortium, the standards body responsible for HTML and XML. Like SQL and OQL, XQuery is a functional language, and it has a type system based on XML Schema.
Functional programmers are generally happy these days with the idea that folds capture common patterns of recursion over datatypes. Only recently, however, is the dual message starting to be accepted: that unfolds capture common patterns of corecursion over datatypes, and that corecursion is (in lazy functional programming at least) at least as important as recursion. In these lectures we explore the definitions and properties of folds and unfolds, and illustrate by deriving programs for arithmetic coding and decoding.
Functional Reactive Programming (FRP) is a DSL embedded in Haskell for programming reactive hybrid systems. The key ideas in FRP are its notions of behaviors (continuous, time-varying values) and events (time-ordered sequences of discrete values). FRP is the essence of Fran, a DSL for programming reactive animations, but FRP is now also being used in vision, robotics, and other control systems applications. In these contexts, performance is critical, and thus control over time- and space-leaks becomes paramount. Interestingly, the use of arrows (a generalization of monads) helps to ensure that common kinds of time- and space-leaks do not occur. In this series of lectures, FRP will be described in detail, with emphasis on its use in robotics applications. Students will program robot simulators and possibly a few real robots.
The hypertext transport protocol (http) forces Web programs to be mostly functional. Interactive Web programs require support from a continuation mechanism so that they are safe for backtracking and cloning. My lecture will explain how to develop such interactive Web programs in functional Scheme with continuations, using DrScheme and its built-in Web server.
In these lectures, we give an overview of concurrent, distributed, and mobile programming with Jocaml. JoCaml is an extension of the Objective Caml language. It extends Ocaml with support for lightweight concurrency and synchronization, the distributed execution of programs, and the dynamic relocation of active program fragments during execution.
The programming model of JoCaml is based on the join calculus. This model is characterized by an explicit notion of locality, a strict adherence to local synchronization, and a natural embedding of the ML programming language. Local synchronization means that messages always travel to a set destination, and can interact only after they reach that destination; this is required for an efficient asynchronous implementation. Specifically, the join calculus uses ML's function bindings and pattern-matching on messages to express local synchronizations.
The lectures and practical sessions will show how to use JoCaml to program concurrent and distributed applications in a much higher-level fashion than the traditional threads-and-locks approach. We will also describe some implementation issues, such as the compilation of synchronization, support for mobility, and integration with Ocaml.
Many algorithms from computational science and engineering that are traditionally implemented in imperative array-based languages (e.g., in Fortran) can be coded more elegantly in a functional language. This especially holds for algorithms that are based on dynamic and irregular data structures, such as sparse matrices and trees. However, runtime performance is usually an important criterion in the implementation of applications that are based on those algorithms, and this is were functional languages often fall short.
In two parts, these lectures introduce a new form of array support for Haskell whose operational semantics is inspired by the parallel functional language Nesl. The first part outlines how nested, irregular arrays can be used to formulate computations on structures, such as sparse matrices and trees. The second part discusses an approach to compiling those algorithms by a sequence of program transformations, such that the transformed programs constitute efficient sequential and parallel implementations of the original program.
As a prelude to the main programme of lectures, on the afternoon of Monday 19th August I will present a short refresher course on the basics of functional programming, using Haskell. The topics covered will include types and classes, mechanisms for defining functions, list comprehensions, recursive functions and types, higher-order functions, and the IO monad. The concepts will be brought together at the end by developing a Haskell program to solve the numbers game from Countdown, a popular quiz show on British television.
On arrival in Oxford, just go straight to the college. The porter's lodge (on Woodstock Road, near the north-west corner) is open 24 hours a day. If you arrive by train, there is a direct bus (number 6) past college, but it only runs from the station on Sundays and in the evenings Monday to Saturday; however, there is a taxi rank at the station, or it is a 30-minute walk. If you arrive by bus (which is the most convenient method for most of the airports), the easiest thing to do is to stay on board until the last stop at the bus station, Gloucester Green; but bizarrely, there are no buses from there to college, and instead you should catch a taxi from the nearby taxi rank or take a 15-minute walk. Don't try to drive: there is no parking in Oxford, and the park-and-ride carparks on the outskirts are not recommended for overnight parking.