Re: Assignment 5 & Related Reading Assignments

Dear CSCI-316 Students,

The “on-time” submission deadline for Lisp Assignment 4 has passed, but late submissions (including corrected submissions) will be accepted until the deadline for late submissions, which will be announced later but will be in December. Possible penalties for late submission were explained on p. 3 of the 1st-day-announcements document.

You can now look at my solutions to all the Assignment 4 problems and QUICKCHECK your submissions on mars.

Viewing Solutions to Assignment 4

To view solutions to problems A - G in Sec. 1 of Assignment 4, logon to your xxxxx_yyyy316 mars account and enter the following:

less /home/faculty/ykong/316/lisp-assignments-4-1.sol

NOTE: If you were able to solve A - G but had to do a lot of thinking to solve problems 1 - 7 in Sec. 2, then you probably did not read the boldface paragraph at the beginning of Sec. 2 on p. 3 of the assignment document carefully!

Solutions to problems 1 - 13 in Sec. 2 of Lisp Assignment 4 are available to you in Scheme. See my “solutions to Assignment 3” email of Oct. 22 and the Scheme PDF file on Brightspace for information on how to access and read the solutions. HOWEVER, you must use the filename A4-kawa.sol (INSTEAD OF A3-kawa.sol). So, after you have started kawa scheme (by entering scm at the shell prompt), enter the following at the #|kawa:1|# prompt:

(load "/home/faculty/ykong/316/A4-kawa.sol")

QUICKCHECKing Your Assignment 4 Solutions

To QUICKCHECK your submitted solutions to Assignment 4, logon to your xxxxx_yyyy316 mars account and follow the instructions (given in my email of 10/11) for QUICKCHECKing solutions to Assignment 2. BUT, at the [1]> prompt you get after you enter ckasn, call quickcheck with a 2nd argument of 4 (NOT 2!), as follows:

(quickcheck '<your last name> 4)

For example, a student whose last name is “Winston” should enter:

(quickcheck 'winston 4)

The parentheses and the ' are needed here!

QUICKCHECK saves a transcript of its actions in:

<your last name in lowercase>-4.check.log

Technical Notes re QUICKCHECK

Read Errors

If QUICKCHECK reports a read error such as:

*** - READ: input stream
 #<INPUT BUFFERED FILE-STREAM CHARACTER
   #P"/home/ ... /submitted-Lisp-assignments/xxxxxxx-4.lsp" @24>
ends within an object. Last opening parenthesis probably in line 18.

there is probably an unmatched opening parenthesis (on line 18 in this example) in your file xxxxxxx-4.lsp.

Similarly, if you get an error such as:

*** - READ from
 #<INPUT BUFFERED FILE-STREAM CHARACTER
   #P"/home/ ... /submitted-Lisp-assignments/xxxxxxx-4.lsp" @22>
: an object cannot start with #\)

there is probably an unmatched closing parenthesis (on line 22 in this example) in the file xxxxxxx-4.lsp. Another possible cause of the same error message would be that you QUOTEd a closing parenthesis on line 22: Lisp expects to see an S-expr after ' and so ') is an error.

In both of these cases, your entire submission is invalid! Enter (exit) at the Break prompt to exit testing. These errors often occur when students write their code on a PC or Mac and fail to test their code on mars before submitting.

Compilation Warnings

If you get some compilation WARNINGs about variables that are “neither declared nor bound”, it might be because you used SETF, which you weren’t allowed to do!

Evaluation Errors

An evaluation error may occur while QUICKCHECK is testing a function:

Testing <function name>
*** - <some error message>
Break 1 [2]>

If this happens, then there is probably an error in your definition of the specific function that is being tested. In such cases you should enter (*rec*) at the Break prompt to continue testing of functions. (An alternative would be to enter (exit) at the Break prompt to exit clisp, but this would abort the testing of your functions.)

Note that you may have to enter (*rec*) more than once for the same function, because QUICKCHECK may test a particular function in more than one way!

Stack Overflow Errors

An error in one of your function definitions may produce a stack overflow. For example:

Testing SET-REMOVE
*** - Program stack overflow. RESET
[6]>

In such a case you should enter:

(ignore-definitions '<func name> '<func name> ...)

where the <func name>s are the names of the function that produced the stack overflow AND all OTHER functions (if any) that call that function. So in this particular example you should enter:

(ignore-definitions 'set-remove 'set-excl-union 'singletons)

assuming that your SET-EXCL-UNION and SINGLETONS both call SET-REMOVE but none of your other functions call SET-REMOVE. As another example, if testing SPLIT-NUMS produces a stack overflow but none of your other functions calls SPLIT-NUMS, then enter:

(ignore-definitions 'split-nums)

After calling ignore-definitions, re-enter:

(quickcheck '<your last name> 4)

to restart function testing.

Infinite Loops

An error in one of your function definitions may cause QUICKCHECK to go into an infinite loop when it tests the function. In that case, try typing Ctrl-C as this may successfully interrupt execution and produce a Break> prompt, at which point you can enter (*rec*) to recover as mentioned above. QUICKCHECK tests some functions more than once (in different ways), so you may have to type Ctrl-C and (*rec*) each time! You may also have to do this for any other functions that call your non-terminating function.

If Ctrl-C does not work, just disconnect from mars and logon again to your xxxxx_yyyy316 mars account. Then re-enter ckasn and enter:

(ignore-definitions '<func name> '<func name> ...)

at the [1]> prompt, where the <func name>s are the names of (a) the function that produced the non-terminating loop, and (b) all other functions, if any, that call that function. After that:

(quickcheck '<your last name> 4)

will restart function testing.

Resubmission Information

In all of the above cases you can resubmit a corrected version of your file (as a late submission) if you wish, provided you do so before the deadline for late submission of Lisp assignments, which will be announced later but will be in December. For further information on making corrected and other late submissions, see the last three paragraphs in my “solutions to Assignment 3” email of October 22.


T. Yung Kong, D.Phil.
Professor
Computer Science Department
Queens College, CUNY
Flushing, NY 11367, U.S.A.