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

please use haskell haskell haskell haskell haskell haskell haskell to write the

ID: 3603674 • Letter: P

Question

please use haskell  haskell haskell haskell haskell haskell haskell to write the following code.

1. 2pts) Create a function, using partial application of functions, that sees if a single Int is divisible by 5. It takes in an Int and returns a Bool. (edited from original to be a bit easier)

2. 2pts) Write a function that checks if every other letter of a string is between 'a' and 'f' (the remaining letters don't matter, start with the first letter in the string, skip the second, and so on). The function takes in a String and returns a Bool. Use partial application at least once. Empty string returns True. (edited to specify what empty string returns, some clarification added).

3. 4pts) Write a function that takes two lists, zips them, then maps the result to a list of sums of the numbers in the tuples. E.g., [1, 2, 3] [4, 5, 6] gets zipped to [(1, 4), (2, 5), (3,6)], then gets mapped to [5, 7, 9].

4. 4pts) Write a function that maps a list of Strings that may have multiple words to Strings with only the first word left. E.g. ["Today is Thursday", "Banquet", "unreal games"] becomes ["Today", "Banquet", "unreal"].

5. 4pts) Write a function that takes a two dimensional matrix of Strings and transforms all empty strings to "0".

Explanation / Answer

Every expression in Haskell has a type which is determined at compile time. All the types composed together by function application have to match up. If they don't, the program will be rejected by the compiler. Types become not only a form of guarantee, but a language for expressing the construction of programs.Functions don't evaluate their arguments. This means that programs can compose together very well, with the ability to write control constructs (such as if/else) just by writing normal functions. The purity of Haskell code makes it easy to fuse chains of functions together, allowing for performance benefits.

Binding a function to fewer arguments helps us in generating other functions to make our code less repetitive and more definitive. But there are some problems with that, and those are apart from not being functionally cool.