Question: Problem 1: Construct a list that has the integers 1 through 5 in it. Use the square bracket notation for lists. Construct the same list,

Problem 1:

  • Construct a list that has the integers 1 through 5 in it. Use the square bracket notation for lists.
  • Construct the same list, but do not use the square bracket notation. Instead use :: and [].
  • Construct the same list again. This time, the following expression must appear in your answer: [2; 3; 4]. Use the @ operator, and do not use ::.

Problem 2:

Write a function that returns the product of all the elements in a list. The product of all the elements of an empty list is 1.

Problem 3:

Write a function that concatenates all the strings in a list. The concatenation of all the strings in an empty list is the empty string "".

Please use Ocaml for the coding

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!