Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

Is there a clear hierarchy of points in my outline?

Answered: 1 week ago