This preview shows page 1. Sign up to view the full content.
Unformatted text preview: which the former first element becomes the last. Lisp&gt; (rotateleft (a b c)) (b c a) Lisp&gt; (rotateleft (rotateleft (a b c))) (c a b) 3.4 Define ROTATERIGHT which is like ROTATELEFT 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 righttoleft that it does from lefttoright. Define PALINDROME such that it takes a list as its argument and returns a plaindrome that is twice as long. 4.1 Define DIVISIBLEBYTHREE, a predicate that determines if an integer is divisible by three. You may want to use REM. Lisp&gt; (divisiblebythree 3) T Lisp&gt; (divisiblebythree 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
 Fall '08
 Arroyo

Click to edit the document details