CS330 Spring 2004 Lecture 10

George Tzanetakis

Slides 

This lecture will not contain any slides as it consists mainly of
programming examples in sml.

SML code

Code in text format
 

Suggested exercises

10.1) Make a library module for rational numbers (addition, multiplication as in assignment 1).
Construct the module in such a way that the representation of rational numbers is hidden from the users of
the module. Write the following structures that match the signature: one using a 2-tupple, one using
an int list with two elements, one using a record and one using a datatype. (Hint: add a function
to generate a rational number from a pair of real numbers and a function to give
a string representation for rational numbers).