Discussion:
confused about part a
(too old to reply)
Donglin Han
2009-03-18 21:20:14 UTC
Permalink
Given multiple products can have the same description, as said in part a
that given a team name, description and quantity of the product, add an
entry....., doesn't it mean the product identifier is also given and the
description given here can be mapped to only this product?
otherwise it won't make sense to talk about the quantity of the product.

also could we use something like this a<-->(b, c, d, e)? how to represent
a quadruple in assignment? and how to get the particular field out from
that quadruple?

Thanks
Nancy Day
2009-03-19 00:25:52 UTC
Permalink
Post by Donglin Han
Given multiple products can have the same description, as said in part a
that given a team name, description and quantity of the product, add an
entry....., doesn't it mean the product identifier is also given and the
description given here can be mapped to only this product? otherwise it
won't make sense to talk about the quantity of the product.
The product identifier is NOT provided as input for operation (a).

The quantity is associated with a product id. Two product ids can have
identical teams and descriptions associated with them.
Post by Donglin Han
also could we use something like this a<-->(b, c, d, e)? how to
represent a quadruple in assignment? and how to get the particular field
out from that quadruple?
Recall the example in tutorial of the telephone book. It had a type
such as:

TelBook: People --> (AreaCode <-> PhoneNumber)

Entries in this telephone book are (p,(ac,pn)) (i.e., triples).

To get a field from this triple, use the relational operators. For example to get
all the area codes associated with someone use dom(TelBook(p))

cheers, nancy
--------------------------------------------------------------------
Nancy Day, Associate Professor
CS245 Winter 2009 Instructor
http://www.student.cs.uwaterloo.ca/~cs245
David R. Cheriton School of Computer Science, University of Waterloo
Continue reading on narkive:
Loading...