CPSC 201: Introduction to Computer Science

 

Instructor: Carsten Schürmann
Department of Computer Science
Yale University
Time: MWF 11:30-12:20
Room: AKW200

  Home
  Schedule
  Handouts
  Assignments
  Projects
  Links
 
 

Lecture 7

Lists are a datatype which is of particular interests because it is a frequently used datastructure in functional programming. The new concept discussed in this class, that a type list is not fixed, but parameterized by the type of elements a list ranges overs. This is called polymorphism, as lists can occur in "many forms".

In this lecture, we define lists, and show how they are used to generate lists of integers, in our case, the Fibonacci numbers.

Code: fibonacci.sml.

Reading: Programming Standard ML.
Chapter 8: Type Inference and Polymorphism
Chapter 9: Programming with Lists
Chapter 10, Sections 10.3-10.4: Recursive Datatypes