{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw2_09 - which the former first element becomes the last...

This preview shows page 1. Sign up to view the full content.

EEL-5840 Class 4 Fall 2009 Dr. Arroyo Homework 2 1 Homework 2: Due Tuesday September 8, 2009 in class Be sure to follow the guidelines for Programming Assignments. Since these problems are simple, you may skip the Statement of the Problem, Approach and Algorithm - Program Flow sections and give an overall conclusion for the entire programming assignment. Make sure you give me a listing of each program and at least three test cases for each. You may wish to use the "dribble" option in the file menu of XLISP to capture the screen as you test your functions. Problems 3-1, 3.3, 3.4 and 3.5 in Chapter 3 of Winston and Horn's LISP (see Below) Problems 4-1, 4-5 and 4-6 in Chapter 4 of Winston and Horn's LISP (see Below) 3.1 Define EXCHANGE, a procedure that returns the elements of a two-element in reverse order. Lisp-> (exchange ‘(adam eve)) (eve adam) 3.3 Define ROTATE-LEFT, a procedure that takes a list as its argument and returns a new list in
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: which the former first element becomes the last. Lisp-&amp;gt; (rotate-left (a b c)) (b c a) Lisp-&amp;gt; (rotate-left (rotate-left (a b c))) (c a b) 3.4 Define ROTATE-RIGHT which is like ROTATE-LEFT except in the pposite direction. You might want to use BUTLAST. 3.5 A palindrome is a list that has the same sequence of elements when read from right-to-left that it does from left-to-right. Define PALINDROME such that it takes a list as its argument and returns a plaindrome that is twice as long. 4.1 Define DIVISIBLE-BY-THREE, a predicate that determines if an integer is divisible by three. You may want to use REM. Lisp-&amp;gt; (divisible-by-three 3) T Lisp-&amp;gt; (divisible-by-three 4) Nil 4.5 Write IF forms that are equivalent to (ABS X), (MIN A B), and (MAX A B), where X, A,and B are numbers. 4.6 Compose COND forms that are equivalent to (NOT U), (OR X Y Z), and (AND A B C)....
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern