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

The first 25 exercises should all have one-line solutions using map, foldr, or f

ID: 3811962 • Letter: T

Question

The first 25 exercises should all have one-line solutions using map, foldr, or foldl. You can also use other predefined functions, of course, but do not write any additional name functions and do not use explicit recursion. If you need helper functions, use anonymous ones. for example, if the problem says "write a function add2 that takes an int list and returns the same list with 2 added to every element," you answer should be fun add2 x = map ( fn a = > a + 2 ) x;

Exercise 1 In ML Language Write a function il2rl of type int list - > real list that takes a list of integers and returns a list of the same numbers converted to type real. For example, if you evaluate il2rl [1,2,3] you should get [1.0, 2.0, 3.0]

Explanation / Answer

we can convert integer numbers to real numbers by using "Real.fromInt" function.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote