Re: FYI: How Any Multiple-Response Items Will Be Scored

Dear CSCI-316 Students,

The on-time submission deadline for Lisp Assignment 5 has passed. Instructions for accessing solutions to Lisp Assignment 5 and QUICKCHECKing your submissions are given below.

See you in class.


How to Access Solutions to Assignment 5 and How to QUICKCHECK Your Assignment 5 Submission

There are 3 parts to these instructions:

Parts I and II assume familiarity with information provided in four earlier e-mails (one sent to you on 10/11, two on 10/22, and one on 10/31) regarding QUICKCHECK and solutions to assignments. But note that you should use ckasn5 instead of ckasn to QUICKCHECK your Assignment 5 submission!

I. How to Access Solutions to Assignment 5

  1. When you enter the following command on mars at the xxxxx_yyyy316@mars:~$ prompt, solutions to the three problems in Sec. 1 of Assignment 5 will be displayed:
less /home/faculty/ykong/316/lisp-assignments-5-1.sol
  1. After you enter scm on mars at the xxxxx_yyyy316@mars:~$ prompt to start Kawa Scheme, use the following Scheme command to get Scheme solutions to the sixteen problems in Sec. 2 of Assignment 5:
(load "/home/faculty/ykong/316/A5-kawa.sol")

After you enter this line you can, for example, enter (pretty-print foo$) to display a solution to problem 14.

NOTE: Make sure you know how to translate my solutions to this and other problems into Common Lisp! That can be done using the table on the 1st page of the Scheme document on Brightspace. A copy of that PDF file was attached to my “Information about Exam 1” email of November 6, BUT SEE NOTE D BELOW!

II. How to QUICKCHECK Your Assignment 5 Submission

To QUICKCHECK your solutions to Assignments 5, logon to your xxxxx_yyyy316 mars account and enter ckasn5 at the xxxxx_yyyy316@mars:~$ prompt. (NOTE: Enter ckasn5 rather than ckasn.) When you see the [1]> prompt, enter:

(quickcheck '<your last name> 5)

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

(quickcheck 'winston 5)

The parentheses and the ' are needed here!

Important: Do NOT use ckasn5 to QUICKCHECK solutions to Assignments 3 and 4; use ckasn to do that. Use ckasn5 only to QUICKCHECK Assignment 5!

The Technical Notes regarding QUICKCHECK in my previous e-mails (e.g., the notes relating to non-terminating loops, stack overflow, and other evaluation errors) still apply! For example, if you get a Break 1 ...> prompt, then you can try entering (*rec*). This may allow QUICKCHECK to carry on with its work.

However, if there are syntax errors such as misplaced parentheses then it is possible that QUICKCHECK will not be able to recover and so you will not be able to QUICKCHECK. (If the syntax errors are such that Clisp cannot LOAD your Lisp file without producing a Break 1 ...> prompt, then your entire submission is invalid and you will receive no credit!)

Be prepared to wait a little while (but certainly no more than 30 seconds) for QUICKCHECK to test your solution to 15b [SLOW-PRIMEP]!

As with previous for-credit assignments, you may submit corrected versions of your solutions (as LATE submissions), provided you do so no later than the late submission deadline. That deadline will be in December and will be announced later.

III. Notes on the Solutions to Assignment 5 (NOTE D IS PARTICULARLY IMPORTANT)

A. On cdr () in Scheme

In Scheme, (cdr ()) is undefined. So whereas Common Lisp programmers would test if a list L is of length 0 or 1 using (null (cdr L)) or (endp (cdr L)), in Scheme (null? (cdr L)) produces an error when L is (). However, Scheme code can use (or (null? L) (null? (cdr L))) or test the two cases separately, as in:

(cond ((null? L) ...)
      ((null? (cdr L)) ...)
      ...)

B. On REMOVE-ADJ-DUPL Simplification

It might appear that the solution to the REMOVE-ADJ-DUPL problem can be simplified: In the case when (equal? (car L) (cadr L)) is true, would it not be better to replace (cons (car L) (cdr (remove-adj-dupl (cdr L)))) with the simpler expression (remove-adj-dupl (cdr L))?

The simplified definition would always return a list that is EQUAL to the list that is produced by the unsimplified definition, so I will also accept the simplified definition as being correct. But, in a sequence of adjacent duplicates, the simplified version returns a list containing just the last duplicate rather than just the first as the question asked!

C. On the map Function

Recall that the function map is Scheme’s version of MAPCAR.

D. On Scheme vs. Common Lisp Differences

The Scheme-vs-Common-Lisp document on Brightspace describes important differences between Scheme and Common Lisp that are relevant to functions that take functions as arguments. A copy of that document was attached to my “Information about Exam 1” email of November 6.

Assuming you’ve done item 5 of the reading that was assigned in my “asn 5 & related reading assignments” email of October 24, you should already have seen concrete examples of these differences.

Because of these differences between Scheme and Common Lisp, you will sometimes need to insert FUNCALL or #' in appropriate places to produce correct Common Lisp functions from the Scheme solutions!


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