Question: Ocaml language Problem 1: Assume the following type definition: type student = {first_name : string; last_name : string; gpa : float} Give OCaml expressions that

Ocaml language

Problem 1: Assume the following type definition: type student = {first_name : string; last_name : string; gpa : float} Give OCaml expressions that have the following types: student student -> string * string (a function that extracts the students name) string -> string -> float -> student (a function that creates a student record)

Problem 2: Write a function safe_hd : 'a list -> 'a option that returns Some x if the head of the input list is x, and None if the input list is empty. Also write a function safe_tl : 'a list -> 'a list option that returns the tail of the list, or None if the list is empty.

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!