Homework Style Guidelines

All programs submitted as homework should satisfy certain style guidelines.
  1. Each source file should start with a header consisting of the following information, in the following standard layout:
    (* filename.sml *)
    (* Name: <submitter's name(s)>
     * Program: <e.g. 1,2, etc>
     * Date submitted: <e.g. 01/04/02>
     *)
    
    (* top-level comment briefly describing purpose and contents of file
     *)
    

  2. All major definitions of functions, types, etc. should be preceded by a comment describing the component being defined, constraints on arguments, and circumstances under which the function raises exceptions. Look at the SML Basis library documentation for examples of how to document definitions. E.g.:
        (* foo: int -> int list
         * "foo x" returns a list of the prime factors of x in ascending
         * order.  Assumes x > 0.  Raises Domain if x <= 0. *)
        fun foo x = ...
    

  3. In signatures, each element of the signature should have a comment.

  4. Comments should be added within function bodies where necessary to understand how the code works.

  5. Dave MacQueen
    Last modified: Mon Apr 8 16:20:35 CDT 2002