a.

Use the Higher-Order Functions map, foldr, and foldl to build a function that turns and integer list L into a list of reals, each of which is the absolute value of the element on L.

===============================================================

b.

Give a value of type (real, real) maping, where the type mapping is defined by

type (‘d, ‘r) mapping= (‘d * ‘r) list;

Your value should have 3 pairs.

===============================================================

c.

Write a function that takes a btree as it’s argument and returns a pair consisting of the left and right subtrees. Define an exception for the erroneous case where the tree is empty.

=======================================================================

d.

Write a program to sort an Array A of length n using A simple n^2 time sort such as bubble sort of insertion sort.

=================================================================

e.

Write a function to cycle an array A of length n by one position

=========================================================

f.

Write expressions to compute the average of the values referred to by x and , which are ref-variables and refer to reals



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *