Define procedure to return the sum of the odd elements, C/C++ Programming

Assignment Help:

(a) Define a procedure (deep-member x e) that takes a list x and an element e and returns #t if the element e is in the list or in any lists that the list x contains.

e.g., (deep-member (list 1 2 (list 3 4 (list 5 6))) 5) => #t

(b) Define a procedure (sum-odd x) that returns the sum of the odd elements in the list x. If an element is itself a list the embedded sum must also be included. In your solution for sum-odd, you must use the filter and accumulate procedures as defined in the notes.

e.g., (sum-odd (1 2 (3 4 5))) => 9

(c) Define a procedure (assoc-list k v) that takes 2 lists of keys, k, and values, v; a list of pairs is returned;

e.g., (assoc-list '(a b c) '(1 2 3)) => ((a.1) (b.2) (c.3)).

(d) Define a procedure (keys a) that takes an association list produced from (c) and returns a list of keys;

e.g., (keys a) => (a b c)

(e) Define a procedure (values a) that takes an association list produced from (c) and returns a list of values;

e.g., (values a) => (1 2 3)

(f) Define a procedure (append-copy x y) that takes 2 list arguments and returns the result of appending the two lists. The procedure must not use the built-in append procedure and must not suffer from the sharing problem as seen in the append procedure described in the notes. For example:

(define a (list 1 2 3))
(define b (list 4 5 6))
(define c (append-copy a b))
c ; Should display (1 2 3 4 5 6)
(set-cdr! b (list 9 10))
c ; Should display (1 2 3 4 5 6)


Related Discussions:- Define procedure to return the sum of the odd elements

Compass bearing, write a c program that converts compass bearings into dire...

write a c program that converts compass bearings into direction

Contacts manager data and image facebook sync, Project Description: coll...

Project Description: collect / modify person records / photo images/ lookup / facebook iphone and ipad App basic function : 1 user will configure facebook connection

C pgms, find area under the curve y=f(x) between x=a &y=b integrate y=f(x)

find area under the curve y=f(x) between x=a &y=b integrate y=f(x)

Explain pros and cons of cpp as a programming language, Write a 3-4 page pa...

Write a 3-4 page paper (350 words per page) in APA format detailing the development and use of C++ in academia and in industry. Explain the pros and cons of C++ as a programming la

Assigment, Hi is there any chance to get assignment for fresher tutor

Hi is there any chance to get assignment for fresher tutor

Program to determine the number is prime or not, Write a function to determ...

Write a function to determine whether a number is prime: it will return true if the input is prime and false otherwise. Use it to see whether -7 is prime.

Constructor , What is constructor or ctor? need help

What is constructor or ctor? need help

Pointers, write short notes about void pointers

write short notes about void pointers

I need website product section search box coding section fix, I need websit...

I need website Product section search box coding section fix Project Description: On our products section in the search box it only searches the name and title of our product

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd