Write a small functions in a tail-recursive manner

Assignment Help Other Subject
Reference no: EM132253924

Programming Languages Assignment: four small F# functions

Overview - Write 4 small functions, 2 in a tail-recursive manner and 2 using a higher-order approach. The exercise is setup on Codio, but you can work in whatever environment you prefer. Regardless of where you work, be sure to submit the 4 functions separately as described in the next section.

Exercises -

Exercise 1: sum4x1 L in a tail-recursive manner

Login to Codio and edit the file "hw0801.fs". Read the comments:

Given a list L of integers, computes sum(4x+1):x in L.

NOTE: write a tail-recursive version using a helper function; do not change the API of the original sum4x1 function.

Write the required function, which will require the definition of a helper function that is tail-recursive. Notice there is no main program. To test your work, open a terminal window and load the file into F# interactive.

Exercise 2: sum4x1 L using a higher-order approach

Edit the file "hw0802.fs". Read the comments, and write the necessary function using a higher-order approach, List.map, and List.sum. Test using F# interactive.

Exercise 3: countBetween A B L in a tail-recursive manner

Edit the file "hw0803.fs". Read the comments, and write the necessary function in a tail-recursive manner. Test using F# interactive.

Exercise 4: countBetween A B L using a higher-order approach

Edit the file "hw0804.fs". Read the comments, and write the necessary function using a higher-order approach. Test using F# interactive.

Attachment:- Assignment Files.rar

Reference no: EM132253924

Questions Cloud

How do you find the running time analysis : How do you find the running time analysis? How do you find the algorithm
Why do people choose a four-year college experience : Describe the opportunity cost of attending a four-year college (assuming a full-time schedule, living on-campus).
What components need to be in a business plan : What components need to be in a business plan? Minimum 3 cited sources
Auto manufacturer entering the electric car market : You are an auto manufacturer entering the electric car market. The design and tooling of the vehicle are complete, and production has started.
Write a small functions in a tail-recursive manner : CS 341 Programming Languages Assignment: four small F# functions. Write 4 small functions, 2 in a tail-recursive manner and 2 using a higher-order approach
What duties did each have that they did not meet : Describe and explain one of each of the following types of agency relationships from the facts of this case; principal/ agent; independent contractor.
What are important assumptions commonly made in cvp analysis : MGMT 312 In a recent news report, the following statement was made: "A report put out by brokerage house CLSA about Jet Airways said that the fall in ATF.
Write on artificial intelligence and expert systems : Write on artificial intelligence and expert systems, and explain its importance in Supply Chain and Logistics Systems.
Explore professional ethics and responsibilities : Create a five slide PowerPoint presentation that explores professional ethics and responsibilities - professional ethics and responsibilities of employees

Reviews

len2253924

3/11/2019 11:41:32 PM

Regardless of where you work, be sure to submit the 4 functions separately as described in the next section. Policy: Individual work only, late work not accepted. Submission: submit electronically on Gradescope. Grading and Electronic Submission - When you’re ready, submit your 4 source code files “hw0801.fs” .. “hw0804.fs” on Gradescope under “HW08”. Note: if you added additional code to the files for testing purposes, such as a main() function, you’ll need to comment out / delete that code before submitting.

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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