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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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