Write a scheme function that takes as an argument a list

Assignment Help Computer Engineering
Reference no: EM132213307

Answer the following Question :

1. Write a Scheme function sumEven that takes as an argument a list of integers L, and returns th e summation of the even number s only in L.

For example, (sumEven '(3 4 5 2 6 8 2)) => 22 (sumEven '(3 1 8)) => 8 (sumEven '(3 1 7 15)) => 0 (sumEven '()) => 0 (sumEven '(6 2 30)) => 38

2. Write a Scheme function divisibleByN that takes as an argument an integer n and a list of integers L, and returns a list of all eleme nts in L that are divisible b y n .

For example, (divisibleByN '3 '(5 9 27 14)) => (9 27) (divisibleByN '4 '(15 6)) => () (divisibleByN '7 '()) => () (divisibleByN '5 '(40 40 40 3 10 50)) => (40 40 10 50)

3. Write a Scheme function swap that takes two atoms and a list as parameters and returns a li st identical to the parameter list except all occurrences of the first given at om in the list are replaced with the second given atom and vice versa.

For example (swap '1 '2 '(1 2 3 1)) => (2 1 3 2) (swap 'a 'b '(c a m b t a)) => (c b m a t b) (swap 'a 'b '(c d e)) => (c d e) (swap 'e 'w '(c d e)) => (c d w) (swap 'w 'e '(c d e)) => (c d w) (swap 'a 'b '()) => ()

Reference no: EM132213307

Questions Cloud

Explain what the five governmental funds have in common : Explain what the five governmental funds, two proprietary funds, and four fiduciary funds have in common with the funds in the same category.
Ask the user for which month and day they were born : Write a script in MATLAB which will ask the user for which month and day they were born on (enter month 1-12 and day 1 to 31).
Write a script using a while loop that serves as data-entry : Write a script using a while loop that serves as a data-entry form: Enter information for two student.
Describe the various forecasting methods : Describe the various forecasting methods. What are the steps needed to develop a forecast? Explain how you could use Excel to help develop a forecast.
Write a scheme function that takes as an argument a list : Write a Scheme function sumEven that takes as an argument a list of integers L, and returns th e summation of the even number s only in L.
Discuss why managers estimate a cost function : Discuss why managers estimate a cost function? Suppose actual cost are higher than estimated cost. Analyze why you may have this difference between actual.
Is berry required to report the amounts : Berry Plastics is a manufacturer. Berry has inventory consisting of raw materials, work in process and finished goods totaling $24 million.
Find the sum of the elements with even indices : Write a script file which finds the sum of the elements with even indices and also the sum of the elements with odd indices of a vector - using one for loop.
Compare the organizational structure of the two codes : The International Ethics Standards Board for Accountants (IESBA) Handbook of the Code of Ethics for Professional Accountants is available for free download.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Describe the impact that crowdsourcing has had

Examine the invention and growth of crowdsourcing in the field of interface design. Describe the impact that crowdsourcing has had on the field of interface design.

  Create component classes as necessary to use together

Use either the array template created in an earlier lab to handle the array or you may use the vector class from the STL to handle the array of student record objects.

  Modify two-dimensional bang-barsky line-clipping algorithm

Modify the two-dimensional bang-Barsky line-clipping algorithm to clip three-dimensional lines against a specified regular parallelepiped.

  Implement a radix sorting machine

Implement a radix sorting machine. A radix sort for base 10 integers is a mechanical sorting technique that utilizes a collection of bins and one main bin.

  Explain your rationale behind the design of your e-r diagram

Create a database schema that supports the company's business and processes. Explain your rationale behind the design of your E-R Diagram.

  How to explain capacity of the queue

How to explain capacity of the queue

  Create all of the content of this page and append it

You should then use JavaScript to create all of the content of this page and append it to the body of the page.

  Develop implementation plan that captures testing activities

Develop a detailed implementation plan that captures Testing activities. Required resources to support these activities.

  Describe the roles and responsibilities of a ciso

describe the roles and responsibilities as well as the delineation of roles and responsibilities between a CISO

  Return the range of values in an array of integers

Write a method called range that returns the range of values in an array of integers.

  Give the code and screenshot of the code working for user

Give the code and the screenshot of the code working for user input and displayed output printed to the command line by the program.

  List and describe the ways to backup the registry

Describe the Windows kernel, including its two main components and list and describe the ways to backup the registry.

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