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
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]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started