CS 5541
Program 0 - Practicing Lisp
Due September 23, 2010
10 points
Introduction
During this semester we are going to be working in Lisp. In this first assignment we will simply be practicing lisp and writing some (hopefully) simple functions. The functions to write are:
- (skipPalindrome list) - write a recursive routine to determine if a list is a palindrome if you consider only the odd elements of the list. Note that you may use a helper routine (if for example you want to pass a second argument to the list you may write a skipPalindromeHelper that does most of the work and have skipPalindrome add the second argument.
- (listPalindrome list) - write a recursive routine that determines if a list is a palindrome such that any sublists are palindromes. For example ((1 2 1) 3 (4 4) (4 4) 3 (1 2 1)) is a listPalindrome in that (1 2 1) is compared to (1 2 1) and each of those lists is a palindrome, 3 compared to 3 (same item) and (4 4) to (4 4).
- (to2DArray list) - take a list of the form ((Xindex1 Yindex1 value) (Xindex2 Yindex2 value) ...) and convert it to a corresponding two dimensional array object. For example, if the list is ((0 0 1) (1 0 2) (1 1 3) (0 1 4)) you should return a 2D array of
You should not assume a value is given for every element of the array (you should have the remaining values be set to nil).
- (to2DList array) - write a function similar to the one above that takes a 2D array and turns it into a corresponding list as described above.
Testing
Shows tests of your method that explore both cases that are and are not palindromes for the routines. Similarly test your array to list translation methods to demonstrate that the results are correct.
What To Hand In
Hand in clean, nicely commented copies of all of your code (make sure to include the class code so we can tell if anything is changed). In addition, hand in results for all of your tests.