Question: Write the following ML functions using map, foldr or foldl higher - order functions. On top of your code Include 3 line comment with your
Write the following ML functions using map, foldr or foldl higherorder functions. On top of your code Include line comment with your name, purpose and date. Precede each function by a oneline comment including exercise number. Save your code as chaptertxt and submit it by canvas.
p Function multpairs of type: int int list rightarrow int list that takes a list of pairs of integers and returns the list of products of pairs. For example: multpairs should return
p function max of type int list rightarrow int that returns the largest element of a given list of integers. Your function need not behave well on empty list. For example: max sim should return
p Function odds of type: int list rightarrow int list so that odds L returns the list of all odd numbers in L in the original order. For example: odds sim should return
p Function cubes of type int list rightarrow int list that returns the list of cubes of the numbers in the given list For example: cubes sim should return sim
p Function product of type int list rightarrow int that returns the product of a list of integers. Your function should return if the list is empty. For example: product sim sim should return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
