Question: Problem 4: Using pattern matching, write three functions, one for each of the following properties. Your functions should return true if the input list has

Problem 4:

Using pattern matching, write three functions, one for each of the following properties. Your functions should return true if the input list has the property and false otherwise.

  • the lists first element is "bigred"
  • the list has exactly two or four elements; do not use the length function
  • the first two elements of the list are equal

Problem 5:

Write a function print_int_list : int list -> unit that prints its input list, one number per line. For example, print_int_list [1; 2; 3] should result in this output:

1

2

3

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!