Last modified: 2023-11-25
This is a course web page of
David Casperson
You are here: homeSemestersFall 2023CPSC 370
Associate Professor
Computer Science
University of Northern British Columbia

CPSC 370: Functional and Logic Programming (2023)

Homework now due

You can find questions that have been assigned due dates here .

Questions 1–7, 9–18 are now past due. If you have not attempted them yet, please do so, and hand them in anyway. I may get around to marking them.

Questions 8 and 19–21 have been assigned due dates.

Homework assigned but without due dates

  1. Which of the following pairs of terms unify? For those that do, give a most general unifier. For those that do not, explain briefly why.
    1. cat  cat
    2. cat  dog
    3. cat  Dog
    4. dog(house(g(V), g(X)), bat(g(g(W))), wiring(X,t))    dog(house(U,       V), bat(g(V)),    wiring(z,t))
    5. 2+X    2+2
    6. 2+X    3+1
    7. dog(house(g(V), g(X)), bat(g(g(W))), wiring(X,W))    dog(house(U,       V), bat(g(V)),    wiring(z,t))
  2. Design your own “interesting” unification question.
    • one pair of which fails to unify
    • one pair of which unifies
    • one pair which only unifies by omitting the occurs check.
  3. Given the facts

    /* just the facts. */
    directlyNorthOf(princeGeorge,redRock) .
    directlyNorthOf(redRock, narnia).
    directlyNorthOf(redRock,stoner) .
    directlyNorthOf(stoner,hixon) .
    directlyNorthOf(hixon,quesnel) .
    directlyNorthOf(quesnel,kersley) .
    directlyNorthOf(kersley,alexandria) .
    directlyNorthOf(alexandria,macallister) .
    directlyNorthOf(macallister,mcleeseLake) .
    directlyNorthOf(mcleeseLake,sodaCreek) .
            
    (text can be found here) determine what is “north of” Kersley?

    That is write a predicate northOf that is the transitive closure of directlyNorthOf, and use it with the above facts.

  4. Write a series of facts about the counties in the United Kingdom (that would be four facts). From the facts, it should be possible to deduce
    • the capital city
    • whether or not there are snakes
    • whether or not there is a dragon on the flag

    For instance, a corresponding fact from France might be

              départment(finistère, quimper, 
                [“Smooth”, “Aesculapian”, “Viperine”,
                 “Common Adder”],
                no).

Home page Semesters Site Map
go back Fall 2023 go forward
2024-07 other links

CPSC 370 [Other years]
Homework
Resources
CPSC 704
David’s Schedule

UNBC Undergraduate Calendar
Dates
Computer Science (BSc)
Regulations

published