Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Haskell Programming (Needs to be done with Haskell) For the programming problems for 3 & 4 file has to be in .hs file format, for

Haskell Programming (Needs to be done with Haskell)

image text in transcribed

image text in transcribed

For the programming problems for 3 & 4 file has to be in .hs file format, for the written problems 1 & 2 can be done within the programming problems 3 & 4 as a big comment or you can do as a separate sperate file for problem 1 & 2 but if you separate the files then make a one zip file for all keep all files together in zip file.

Put your programs in a .hs file. Answers to written questions can be done as a big comment in your.hs file, or you can include them in a separate file, but please zip the files together and submit the zip file. Questions [100 points total Written Problems [1 1 points] Let expl ( fold! . fold! ) (-) a [ [ b, c, d ] , [ e , f , g ] . Using the style in Lecture 7, calculate expl symbolically down to use just subtraction, variables, and parentheses. Feel free to introduce names for intermediate expressions te.g., x1 = [ b, c , d ] etc). 2. [10 points] Let exp2 be exp1 except that it starts with (foldr. etc.). Calculate exp2 symbolically far enough to illustrate a brief explanation as to why exp2 is type-incorrect. Programming Problems 3. [24 = 5 * 6 points] The goal is to write a getNords ::: String-> [ String ] function that breaks up ts input string into space-separated words. E.g.. getWords" ab d+ ["ab","", "d,1. (There's a built-in words function that does this, but don't define getWords-words-) On the other hand, do look up the isSpace routine in Data.Char Define and use some utility functions: skipspaces:: String->String strips off leading spaces from its input and getWord:: String -> (String, String) pulls off the leading word from its input and returns the word and remaining input. Eg.. getWord " xy z " = ( "" , " z " ) . You'll probably want to define at least one more helper routine, but that's are up to you. Implement getWords non-monadically. Some key milestones along the way: Strip off leading spaces from a string, returning the leftover string. .Get leading word from a string, returning the word and leftover string Repeat getting the leading word from a string and adding it to a list of words Handle stopping when you reach the end of the input string instead of the next word. Return the correct list of words. Put your programs in a .hs file. Answers to written questions can be done as a big comment in your.hs file, or you can include them in a separate file, but please zip the files together and submit the zip file. Questions [100 points total Written Problems [1 1 points] Let expl ( fold! . fold! ) (-) a [ [ b, c, d ] , [ e , f , g ] . Using the style in Lecture 7, calculate expl symbolically down to use just subtraction, variables, and parentheses. Feel free to introduce names for intermediate expressions te.g., x1 = [ b, c , d ] etc). 2. [10 points] Let exp2 be exp1 except that it starts with (foldr. etc.). Calculate exp2 symbolically far enough to illustrate a brief explanation as to why exp2 is type-incorrect. Programming Problems 3. [24 = 5 * 6 points] The goal is to write a getNords ::: String-> [ String ] function that breaks up ts input string into space-separated words. E.g.. getWords" ab d+ ["ab","", "d,1. (There's a built-in words function that does this, but don't define getWords-words-) On the other hand, do look up the isSpace routine in Data.Char Define and use some utility functions: skipspaces:: String->String strips off leading spaces from its input and getWord:: String -> (String, String) pulls off the leading word from its input and returns the word and remaining input. Eg.. getWord " xy z " = ( "" , " z " ) . You'll probably want to define at least one more helper routine, but that's are up to you. Implement getWords non-monadically. Some key milestones along the way: Strip off leading spaces from a string, returning the leftover string. .Get leading word from a string, returning the word and leftover string Repeat getting the leading word from a string and adding it to a list of words Handle stopping when you reach the end of the input string instead of the next word. Return the correct list of words

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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions