Lab 7 Instructions #
While other students are coming into class, follow the setup instructions below. (But please wait until you’re instructed before beginning work on the lab.)
Do you have hints about the course? Let me know: email@example.com.
Setup instructions #
Lab puzzle #
Consider the following signature for an integer queue module and its corresponding implementation, as presented in the textbook.
module type INT_QUEUE = sig type int_queue val empty_queue : int_queue val enqueue : int -> int_queue -> int_queue val dequeue : int_queue -> int * int_queue end ;; module IntQueue : INT_QUEUE = struct type int_queue = int list let empty_queue : int_queue =  let enqueue (elt : int) (q : int_queue) : int_queue = q @ [elt] let dequeue (q : int_queue) : int * int_queue = match q with |  -> raise (Invalid_argument "dequeue: empty queue") | hd :: tl -> hd, tl end ;;
Which of the following expressions are well formed and well typed? In case more than one is well formed, select the first one.
IntQueue.enqueue 1  ;;
let open IntQueue in empty_queue ;;
fun (q : INT_QUEUE) -> INT_QUEUE.enqueue 1 q ;;
fun (q : IntQueue) -> IntQueue.enqueue 1 q ;;
fun (q : int_queue) -> IntQueue.enqueue 1 q ;;
fun (q : IntQueue.int_queue) -> IntQueue.enqueue 1 q ;;
H. None of the above.