Lecture 3 - Page 13 : 43
Programming Paradigms
Simulation of other Paradigms and Continuations
* Object-oriented Programming
Functions and closures revisited
Classes and objects
A general pattern of classes
Example of the general class pattern
A general pattern of classes with inheritance
An example of classes with inheritance
The interpretation of self
A general pattern of a class hierarchy with virtual methods
An example of virtual methods
Summing up: Simulation of OOP in Scheme
* Imperative Programming
Imperative Programming in a Functional Language
Sequential Control
Jumps in Functional Programs
Selection Control
Iterative Control
Assignments in Functional Programs
State in Functional Programs
Object Mutation
* Continuations
Introduction and motivation
The catch and throw idea
A catch and throw example
The intuition behind continuations
Being more precise
The capturing of continuations
Capturing, storing, and applying continuations
Use of continuations for escaping purposes
Practical example: Length of an improper list
Practical example: Searching a binary tree
* Continuation Passing Style
Continuation Passing Style
Observations about continuation passing style
* Coroutines
Coroutines
Simulating Coroutines in Scheme
A simpel producer and consumer
Simultaneous traversal of two binary trees (1)
Simultaneous traversal of two binary trees (2)
* Trampolining
Trampolining
More exercises
Imperative Programming in a Functional Language
To which degree can we do imperative programming in a functional programming language?
Points of interest
Sequential control
Jumps and goto
Selection control
Iteration control
Assignment
State transitioning