Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

-Could you please answer the following excercises in the following screenshots .

ID: 3890036 • Letter: #

Question

-Could you please answer the following excercises in the following screenshots .

- Haskell programming should be used.

Haskell-the-craft-offunctionalprogramming.pdf - Adobe Acrobat Reader DC File Edit View window Help - ax Home Tools Haskell-the-craft-of... X O Sign In e A 8 3 a O 0 as 1 50 EXERCISES M 0 0 1sos c ] R & D R 9 1 LS Export PDF v 4.51 Give a definition of the function Create PDF Y Edit PDF OF joinLine :: Line -> string which turns a line into printable form. For example, joinLine I "dog", "cat" ] = "dog cat" Comment 1 Combine Files ED Organize Pages v 124 Data structures: lists Fill & Sign the Send for Signature 452 Using the function joinLine, or otherwise, define the function Send & Track joinLines :: [Line] -> string which joins together the lines, separated by newlines. O More Tools 4.53 [Harder] Modify the function joinLine so that it justifies the line to length lineLen by adding the appropriate number of spaces between the words Store and share files in the Document Cloud Learn More Type here to search 12:12 AM on p) ENG 9//24/2017

Explanation / Answer

The most basic way of defining a function in Haskell is to ``declare'' what it does.

1) Joinline

string :: string->string

string |"string1" , "string 2"| = "string1 string2".

for ex.

joinline |"dog" , "cat"| = "dog cat".

2) Joinlines.

lines :: line -> line

line|"line 1" , "line 2"| = "line1 line 2".

for ex.

joinlines |"my name is abc. " "i am from xyz. "| = my name is abc. i am from xyz.

only difference between "joinline" and "joinlines" is that joinlines join the lines which end with line breaks.

3) Ljoinline.

string :: (string -> string) linelen=10;

string :: |"string1" , "string 2"| = ("string1 string 2")linelen 10;

for ex.

ljoinline :: |"trap" , "tapped"| = ("trap trapped")linrlen 10 = ("traptrapped").

the function "ljoinline" alters the combined string using spaces between words according to the length of line given.

4) wc.

wc :: string -> (int,int,int);

wc :: |"string"| = "no of characters" , "no of words" , "no of lines" .

for ex.

wc :: |"my name is abc"| = "14 , 4 , 1".