University of Texas at Arlington Write Appropriate Calls Computer Science Task

Relax! Stop worrying about deadlines and let our professional writers help you. Hire an essay writer helper and receive a professional assignment before your deadline. We provide writing services for all types of academic assignments.

Order a Similar Paper Order a Different Paper

1. Consider the following Lisp function which applies a function f between every two adjacent elements of a list x, treating v as the final value.

 (defun reduce (f x v)


((null x) v)

     (t (apply f (list (car x) (reduce f (cdr x) v))))



Write appropriate calls to reduce to do the following:

(a) Add a list of numbers – test using (272 480 757 1360 1561). (b) Multiply a list of numbers – test using (4 11 25 3673).

(c) Determine the length of a list – test using (csce 4430 is easy using lisp). (d) Reversealist-testusing(esctnu).

2. Write Lisp functions to compare adjacent list elements and return a list, as described in each case. You should not use any built in Lisp functions beyond what we covered in class. The sample responses are all with the input list (a b a a a c c). Test your function on this list in each case.

(a) Remove the second and succeeding adjacent duplicates, yielding (a b a c). (b) Leave only the elements that are not repeated, yielding (a b).

(c) Leave only one copy of the repeated elements, yielding (a c).

(d) Count the number of repeated occurrences, yielding ((1 a) (1 b) (3 a) (2 c)). 

Great students hand in great papers. Order our essay service if you want to meet all the deadlines on time and get top grades. Professional custom writing is the choice of goal-focused students. Word on the online streets is... we're simply the best!

Get a 15% discount on your order using the following coupon code SAVE15

Order a Similar Paper Order a Different Paper