Question: Can you please help me to create test problems ( at least 3 options for each question ) to ensure that my ML code is
Can you please help me to create test problems at least options for each question to ensure that my ML code is working properly?
Question Define a function mymap with the same type and behavior as map, but without using map.
Note this should still be a oneliner: use foldl or foldr.
fun mymap f lstfoldr fnx accf x :: acclst;
val mymap fn : a b 'a list b list
Question Define a function mymap with the same type and behavior as map. No map,
foldr, or foldl can be usedrefer to problem Exercise on page
fun mymap f lst if null lst then else f hd lst::mymap ftl lst;
val mymap fn : a b 'a list b list
Question Write a function ordlist of type char list int list that take a list of characters
and returns the list of integer codes of those charactersFor exampleif you
evaluate ordlist #A#b#Cyou should get refer to
Exercise on page
fun ordlist lst map fn c ord c lst;
val ordlist fn : char list int list
Question Write a function mylength fo type a list int that returns the length of a list.
You cannot use the builtin length functionrefer to Exercise on page
fun mylength mylength ::restmylength rest;
val mylength fn : 'a list int
Question Write a function max of type int list int that returns the largest element of
a list of integersYour function need not behave well if the list is empty
fun max raise Empty maxxx maxx::xs if xmax xs then x else max xs;
val max fn : int list int
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
