CSE 341, Winter 1997
D. Notkin
Minor Assignment #2
Due: 1/31/97
This assignment will help you gear up in understanding
and using CLP(R), the programming language we're using this quarter
to demonstrate the logic and constraint logic programming paradigms.
Details on where to find CLP(R), etc. will be posted on the mailing
list.
- Define a binary relation credits
that gives the name and number of credits for every 300- and 400-level
course (except CSE490, CSE498, and CSE499) in the Department of
Computer Science and Engineering. Write the following queries:
- Determine how many credits cse341 has.
- Determine all courses that have 5 credits.
- Determine if any course is worth 10 credits.
- Define a binary relation build(A,B)
that determines if file A
must be rebuilt if file B
changes; that is, if you include
depends(main,snork).
depends(snork,fork).
in your database you mean that if snork
is changed you have to rebuild main
and that if fork
is changed you have to rebuild snork.
Also define a binary relation build
that determines if rebuilding has to take place; remember, if
you change fork
in this database, you have to rebuild snork
and that in turns causes you to have to rebuild main.
In other words, build
is the transitive closure of depends.
- Write a 4-ary relation time
that defines a total number of seconds in terms of a number of
hours, minutes, and seconds. Write the following queries:
- Determine how many seconds there are in 1 hour,
1 minute, and 1 second.
- Determine how many additional seconds are needed
to make 1 hour and 3 minutes combine to 3800 seconds.
- Determine how many seconds there are in a 50-minute
cse341 lecture.
- Determine which combinations of hours, minutes
and seconds total 1000 seconds.