CSE 130: Principles of Programming Languages
Homework Assignments

BinProlog 4.00 binary for ACS Solaris machines is on the ACS directory for CSE 130, /home/solaris/ieng9/cs130w/public/prolog/bp where everyone in the class should have an account. The prolog/ directory mentioned above also has a file ex1.pl that you may find useful. Some basic notes on using BinProlog 4.00 are at binpro.html. BinProlog 4.00 binary for CSE Solaris machines (such as beowulf, bintijua, kongo, and machines in the APE lab) can be accessed via /net/cs/class/wi99/cse230/prolog/bp, and also as a backup, /net/cat/disk1/prolog/bp.

Solutions are now available for homework Set 2, Set 3, Set 4, Set 5, Set 6, and Set 7.


NOTES:
  1. Due 15 January:
    1. Say where Java would go in the Figure on p.23 of Stansifer; write a short paragraph of about 30 words justifying your choice. (You can just photocopy the figure and add a line and dot for Java in red ink.)
    2. Briefly compare Java with at least three other languages from among those described in Chapter 1 of Stansifer (FORTRAN, COBOL, BASIC, Algol, C, Lisp, ML, Ada, C++, etc.); the languages that you choose for comparison should be very different from each other.
    Note: If you are unfamiliar with Java, you should be able to learn enough to answer the above questions in about 30 minutes, by going to the campus bookstore (or nearly any other bookstore in the country) and skimming parts of one or more of the many Java books there.
     
  2. Due 22 January:
    1. Write a regular expression that will cause grep to search for, and print the instances of, all the Ada identifiers (as defined on p.45 of Stansifer) that occur as lines in an input file; test it on the file grep.data.html. You may use any convenient variant of grep, such as egrep; you can type "man grep" or "man egrep" etc. at any Sun workstation to learn what you need to know. Be sure to hand in your output file, plus of course your regular expression.
    2. Exercise 2.3 of Stansifer (p.69).
    3. Exercises 2.8 and 2.9 of Stansifer (p.70).

  3. Due 29 January:
    1. Exercise 2.11 of Stansifer (p.71).
    2. Exercise 2.20 of Stansifer (p.73).
    3. Exercise 3.1 of Stansifer (p.100).
    4. Exercise 3.2 of Stansifer (p.100).
    Note: The last two problems were added later than five days before the due date, so they should be considered extra credit questions.
     
  4. Due 5 February: No homework is due this week; please study for the midterm. The following questions, as well as some of those assigned for next week, may help you with this.
    1. Exercise 3.5 of Stansifer (p.101).
    2. Exercise 3.8 of Stansifer (p.102).
    3. Exercise 4.3 of Stansifer (p.137).

  5. Due 12 February:
    1. Exercise 3.4 of Stansifer (p.101).
    2. Exercise 4.8 of Stansifer (p.138).
    3. Exercise 4.11 of Stansifer (p.138).
    4. Exercise 5.1 of Stansifer (p.179).
    Note: Since material for problems 2.-4. was not covered in class before the due date, it is ok to hand in answers to those problems as late as 19 February.
     
  6. Due 21 February:
    1. Exercise 5.3 of Stansifer (p.179).
    2. Exercise 5.4 of Stansifer (p.179).
    3. Exercise 5.5 of Stansifer (p.179).

  7. Due 5 March (was 28 February): Use Prolog for each problem; be sure to include your input and your output; if you prefer to use another Prolog system then BinProlog, you may do so, but you may have to use a somewhat different syntax from that of BinProlog.
    1. Exercise 6.1 of Stansifer (p.208).
    2. Exercise 6.2 of Stansifer (p.209).
    3. Exercise 6.6 of Stansifer (p.210).

  8. Due 12 March (was 7 March): Use Prolog for each problem; be sure to include your input and your output.
    1. Given the following relations father(X,Y) mother(X,Y) female(X) male(X) for "X is the father of Y", "X is the mother of Y", "X is female", and "X is male", define relations for the following:
      1. sibling (i.e., brother or sister);
      2. sister;
      3. grandson;
      4. first cousin; and
      5. descendent.
      Test your code on some examples that are complex enough to show that it works well.
    2. Using only the append relation, formulate queries to determine the following:
      1. the third element of a list;
      2. the last element of a list; and
      3. all but the last element in a list.
      Test your code on some examples that are complex enough to show that it works well.

  9. No homework is due 14 March; please review for the final exam.

To CSE 130 homepage
Maintained by Joseph Goguen
© 2000, 2001, 2002 Joseph Goguen
Last modified: Wed Apr 3 11:52:31 PST 2002