CS6470 Homework 1

Due before class starts on Tuesday 1/15/2008.
  1. Find a machine where you can run a recent (3.08 or newer) version of OCaml. You can install it yourself somewhere or use the version on shell.cs.
  2. Using resources on the OCaml web site (the manual and various tutorials and books are good places to start), start to learn to write OCaml code. Show that you can write code in this language by constructing a solver for the n queens problem. Your program should take two command line arguments: the first is the board dimension and the second is either "noreduce" or "reduce". If "noreduce" is specified, you are to print all distinct solutions, and if "reduce" is specified then only unique solutions may be printed (using the definitions of distinct/unique from the web page). You may not look at existing n queens solutions (on the web or from your classmates). Code this up from scratch.
  3. Write an implementation for this interface. These functions are part of a simple analyzer that determines whether the values in a program are even or odd. For example, your function plusa should encode the well-known rule that adding two numbers of the same parity results in an even number, and that adding two numbers of different parity results in an odd number. You should assume that these operations are the standard ones provided by the C language and that the operands are two's complement integers. Before submitting your code you should test it to ensure that it works as expected. Do not hand in your your test scaffolding.
  4. Handin two files nqueen.ml and even_odd.ml on a CADE lab machine using this command:
      handin regehr hw1 nqueen.ml even_odd.ml