Last modified: 2016-10-14
This is a course page of
David Casperson
Associate Professor
Computer Science
University of Northern British Columbia

CPSC 370: Functional and Logic Programming (2006)

Homework Questions now due

Pending homework questions

  1. Write winning and losing functions for Doubling Nim. Follow the link to get detailed rules for the game.

    For assignment credit use some kind of straight-forward logic. For your own amusement see if you can make the running time more reasonable. For this game, there is an algorithm that allows you to calculate winning positions in your head; although it takes a bit of practise.

    If you wish to check your logic, here is a binary that runs on galaxy.unbc.ca.

  1. Write a function uncurry2 that has the property that f = uncurry2 (curry2 (f)).
  2. Write a function curry3.
  1. Determine the behaviour of the function defined by
      fun f n = if n>100 then n-10 else f(f(n+11))
    
    Attempt to prove that your answer is correct by some form of induction.
  2. Write a tail-recursive power function that computes xn efficiently.
  3. Write a Prolog differentiatiation relation.
  4. Write a Prolog simplification function.
  5. Write a Scheme function to reverse a list.
  6. Write a Scheme function to fold a list à la SML.
Home page Semesters Site Map
go back Fall 2006 go forward
2017-11 other links

Semester Map
CPSC 141
CPSC 200
CPSC 370
Course Outline
Handing in Homework
Pending Homework Questions
Solutions
Policies
References
David’s Schedule