Write functions in the following exercises, for example, the function for cube of type int -> int that returns the cube of its parameter is: fun cube x = x*x*x. Exercise 3 Write a function fourth of type 'a list -> 'a that returns the fourth element of a list. Your function need not behave well on lists with less than four elements. Exercise 6 Write a function thirds of type string -> char that returns the third character of a string. Your function need not behave well on strings with lengths less than 3. Exercise 9 Write a function de 13 of type 'a list -> 'a list whose output list is the same as the input list, but with the third element deleted. Your function need not behave well on lists with lengths less than 3.
![Write functions in the following exercises, for example, the function for cube of type int ->
int that returns the cube of its parameter is: fun cube x = x*x*x.
Exercise 3 Write a function fourth of type 'a list -> 'a that returns the
fourth element of a list. Your function need not behave well on lists with less than
four elements.
Exercise 6 Write a function thirds of type string -> char that returns
the third character of a string. Your function need not behave well on strings with
lengths less than 3.
Exercise 9 Write a function de 13 of type 'a list -> 'a list whose output
list is the same as the input list, but with the third element deleted. Your function
need not behave well on lists with lengths less than 3.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0b2ab733-cdff-4467-acfa-a0c1d6eb4317%2F65c2dd16-60d1-496b-b829-bd66714b48c3%2Fbz5c9ww_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Algorithm: Exercise 3
Step 1 Start.
Step 2 Define a function named fourth that takes a list lst as an argument.
Step 3 Return the element at index 3 of the input list lst.
Step 4 End of function.
Step 5 Create a list lst with six integers in it.
Step 6 Call the fourth function with lst as its argument and print the returned value.
Step 7 End.
Algorithm: Exercise 6
Step 1 Start.
Step 2 Define a function named "thirds" that takes a string as an argument.
Step 3 Return the character in the third position of the input string.
Step 4 Assign a string "Hello World" to a variable named "string".
Step 5 Call the "thirds" function and pass "string" as an argument.
Step 6 Print the returned value.
Step 7 End.
Algorithm: Exercise 9
Step 1 Start.
Step 2 Define a function called "de_13" that takes a list as an argument.
Step 3 Within the function, delete the element at index 2 in the list using the "del" statement.
Step 4 Return the modified list.
Step 5 Outside the function, create a list called "lst" with six integer elements.
Step 6 Call the "de_13" function with the "lst" list as an argument and print the returned value.
Step by step
Solved in 4 steps with 6 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)