[Santa Clara University]
Department of Mathematics
and Computer Science

Machine Problem 6

Math 61
D. C. Smolarski, S.J.
Winter, 2000

                
Data Structure Concepts: LISTS
AND LISP
30 points
DUE: Noon, Thursday, February 24, 2000

This assignment is to familiarize you with the list-processing language LISP.

1) Re-do the sample session given in the LISP 2 web page. (You should turn in a script copy of your session--see below.)

2) Compose a function called MAKELIST which makes a list of the first n integers, i.e.,

       (MAKELIST 5)  
returns (1 2 3 4 5).

3) Compose a function called SELECT which selects the n-th element of the list given, i.e.,

       (SELECT '(2 3 4 5) 2)
returns 3.

4) Compose a recursive FACTORIAL function (base it on the exponential function), and run BOTH the recursive version and the iterative version in the class notes to compute 50!

NOTES:

  1. This is NOT a team project--work individually!!

  2. It may be easier to make the functions of 2) and 3) RECURSIVE.

  3. Give appropriate examples that your functions work, by scripting a LISP session using your functions.

  4. There are at least two free-ware versions of LISP, one called XLISP and the other PC-LISP, which work on an IBM-PC (compatible) in DOS mode. Both can be downloaded from the software depository at Oakland University (try the Walnut Creek Simtel Net site and then the MS-DOS software and search for "lisp").

    (I may have copies of this software in my office--if you wish, bring me a disk so you can get a copy in my office. There are also manuals in files on the distribution disk.)


This page is maintained by Dennis C. Smolarski, S.J., dsmolarski@math.scu.edu. Last changed: 12 January 2000.