Computer programming - Lab 12

1. Implement a function rev_append that takes two (integer) lists l1 and l2 and returns the list obtained by appending the elements of l1 in reverse order in front of l2. Implement the function
a) using only the list interface, without destroying l1 (this will allocate cells for the elements placed in front of l2)
a) by reversing l1 in place (updating only the links), without allocating extra memory cells

2. Write a function nodup that takes an (integer) list and returns the list with all consecutive duplicates removed. Implement it:
a1) using only the list interface, by creating a new list, without changing the initial one
a2) using only the list interface, allocating new cells only if needed (i.e., not for the last part without duplicates)
b) in place, updating the links directly, and deleting the duplicate cells

3. Define a set type that can hold uppercase and lowercase characters represented on a 64-bit word and the basic operations on it.

4. Implement a library for lists of lists. Use it to represent the lines of text read until end of input: each line is represented by its list of non-whitespace characters.
Use this to determine the set of letters that appear either just lower-case or just upper-case in the list. Do it without traversing the list twice.

5. Implement a library for lists of lists. Use this to read and simplify a boolean formula as follows: an uppercase letter represents a proposition, and a lowercase letter the negation of the same proposition.
The first line of text read from input represents all literals that are true.
The next lines, until end of input, represent a formula in conjunctive normal form: each line is a clause (literals are considered connected with OR); clauses are considered connected with AND. Lines may contain whitespace.
Simplify the formula using the values of the propositions given on the first line (values might not be specified for all propositions).

Marius Minea
Last modified: Sat Dec 14 18:30:00 EET 2013