# 12 - are also similar to n-ary products. Suppose we wish to...

This preview shows page 1. Sign up to view the full content.

2. Let A 1 , . . . , A n be arbitrary sets. The n -ary product of the A i , written A 1 × . . . × A n or ± n i =1 A i , is { ( a 1 , . . . , a n ) : a i A i for 1 i n } . The n -ary product of A s is written A n , with A 2 corresponding to the Carte- sian product introduced in deFnition 2.11. The following examples are sim- ple examples of n -ary products. 1. The three dimensional space of real numbers R 3 . 2. The set timetable = day × time × room × courseno : a typical element of this set is ( Wednesday , 11.00, 308, 140). In Haskell notation, this timetable example can be given by: type Day = String type Time = (Int, Int) type Room = Int type CourseNo = Int type Timetable = (Day, Time, Room, CourseNo) (Wednesday, (11,00), 308, 140) :: Timetable 3. Record types
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: are also similar to n-ary products. Suppose we wish to have a database which stores information about people. An array will be unsuitable, since information such as height, age, colour of eyes, date of birth, will be of different types. In many procedural and object-oriented languages, we can instead deFne Person = RECORD who : Name; height : Real ; age : [0. ..120]; eyeColour : Colour; dateOfBirth : Date END This record is like a Haskell type augmented with projector functions: type Name = String type Colour = String type Date = (Int, Int) type Person = (Name, Float, Int, Colour, Date) 13...
View Full Document

## This note was uploaded on 01/02/2010 for the course MATH Math2009 taught by Professor Koskesh during the Spring '09 term at SUNY Empire State.

Ask a homework question - tutors are online