Question: Exercises: preamble On Portacle, type C-x C-f to create a new file solution.lisp in your Lab03/ folder, and copy-paste the program below in your


Exercises: preamble On Portacle, type C-x C-f to create a new filesolution.lisp in your Lab03/ folder, and copy-paste the program below in your

Exercises: preamble On Portacle, type C-x C-f to create a new file solution.lisp in your Lab03/ folder, and copy-paste the program below in your solution.lisp. To copy-paste text to a window buffer in emacs on Portacle: use the cursor to highlight the text, then click on the location you would like to paste the text, and press C-y (defstruct movie title director year type) (defparameter *size* 3) (defvar *db*) (setf *db* (make-array *size* :initial-element nil)) (defun add-movie (m) "Adds a movie to *db* and returns *db*" (dotimes (i *size*) (when (null (aref *db* i)) (setf (aref *db* i) m) (return *db*)))) (defun in-db? (title) "Returns *db* if movie title is in the database; otherwise returns NIL" (dotimes (i *size*) (when (and (typep (aref *db* i) 'movie) (equal (movie-title (aref *db* i)) title)) (return *db*)))) In the exercises below, you will be asked to change function ADD-MOVIE and add other functions to this program. NOTE: you should not change the definition of the structure MOVIE provided above when solving these exercises. Exercise 1 Preamble Function ADD-MOVIE above adds a movie to the *db* and returns *db*. What you are asked Change function ADD-MOVIE so that it returns NIL if the database is already full. Also, if the movie title is already in the database, it returns NIL. Otherwise it adds the movie to the database and returns the array. See more examples by typing on the REPL CL-USER> (show-test-cases :lab03 'test-add-movie)

Step by Step Solution

3.40 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

On Portacle type Cx Cf to create a new file solutionlisp in a folder and copypaste the program be... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related American History Questions!