Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would some help with this which is to You must implement your functions recursively. In the event that Haskell has a function that does

I would some help with this which is to You must implement your functions recursively. In the event that Haskell has a function that does what you are asked to do, you may not simply call the Haskell function you must implement the functionality yourself. (E.g. no fair calling elem if you are asked to determine whether an item is a member of a list.) If you have an idea as to how to approach a problem, but cannot figure out how to express it in Haskell, describe your idea and I will consider it for partial credit. Be sure to provide type declarations for each of your functions, in addition to the function itself. Write all of your functions in a single Haskell file, which you will submit via Blackboard. You can load your file into the GHCi interactive system using: l. You do not need to provide a main or other interface. Your functions will be tested by loading them into an interactive session and passing them through HUnit tests. Thanks for the help.

image text in transcribed

5. (3 points). Write a function cumulativeSum that takes a list of Int and returns an int list of the partial sums of the numbers in the list. For example, cumulative Sum [] -> [] cumulativeSum [12, 27, 13] -> [12,39,52] 6. (3 points) Write a function longest String that takes a string list and returns the longest string in the list. If the list is empty, return (i.e., an empty string). In the case of a tie, return the string closest to the beginning of the list. longest String ["abc", "Hello", "car", "apple"] -> "hello" longest String [] -> "" 7. (3 points) Write a function longest LowerString that takes a string list and returns the longest string in the list that begins with a lowercase letter, or if there are no such strings. longest LowerString ["abc", "Hello", "car", "apple"] -> "apple" longest LowerString ["ABC", "Hello"] -> "" 5. (3 points). Write a function cumulativeSum that takes a list of Int and returns an int list of the partial sums of the numbers in the list. For example, cumulative Sum [] -> [] cumulativeSum [12, 27, 13] -> [12,39,52] 6. (3 points) Write a function longest String that takes a string list and returns the longest string in the list. If the list is empty, return (i.e., an empty string). In the case of a tie, return the string closest to the beginning of the list. longest String ["abc", "Hello", "car", "apple"] -> "hello" longest String [] -> "" 7. (3 points) Write a function longest LowerString that takes a string list and returns the longest string in the list that begins with a lowercase letter, or if there are no such strings. longest LowerString ["abc", "Hello", "car", "apple"] -> "apple" longest LowerString ["ABC", "Hello"] ->

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions