[Solved] PL-Assignment 4-a Haskell function maxlist lt that computes the maximum element of list lt

$25

File Name: PL-Assignment_4-a_Haskell_function_maxlist_lt_that_computes_the_maximum_element_of_list_lt.zip
File Size: 847.8 KB

SKU: [Solved] PL-Assignment 4-a Haskell function maxlist lt that computes the maximum element of list lt Category: Tag:
5/5 - (1 vote)

Assignment 4

  1. Write a Haskell function maxlist lt that computes the maximum element of list lt (Assume that the list lt contains at least one element).

E.g. > maxlist [3,1,6,4,2,3] = 6 //the maximum element in the list is 6

  1. Write a Haskell function delete k lt that removes every kth element of a list lt.

E.g. > delete 2 [3,4,5,6,7,8,9] //remove the 2nd, 4th, and 6th element

[3,5,7,9]

  1. Write a Haskell function isort lt that sorts an integer list lt into ascending order using the insertion sort. E.g. > isort [7,3,9,2] = [2,3,7,9]
  2. Write a Haskell function rotate n lt that rotates a list lt n places to the right. Assume that lt contains at least n elements.

E.g. > rotate 3 [1,2,3,4,5,6,7] = [5,6,7,1,2,3,4] // rotate the list 3 places to the right

  1. Write a Haskell function single lt that changes a list lt into a list of lists by making each element into a singleton list.

E.g. . > single [1,2,3,4] = [[1],[2],[3],[4]]

  1. Write a Haskell function double lt that doubles every element appearing the odd positions of l

e.g. > double [1,3,4,5] = [2,3,8,5] //double 1 and 4

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] PL-Assignment 4-a Haskell function maxlist lt that computes the maximum element of list lt
$25