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

CPSC 370: Functional and Logic Programming (2010)

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 2010 go forward
2024-12 other links

Software

CPSC 200
Java
Building .jar files
CPSC 370
Blackboard
Books
Course Outline
Policies
Programming Policies
Prolog Resources
Syllabus
David’s Schedule

University Calendar

fall-2024