lec 06 modules???

This commit is contained in:
SowinskiBraeden committed 2026-02-12 11:50:38 -08:00
1 parent 2d9678fd1f
commit c8f6dd3df2
15 files changed
+464

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
type 'a t = 'a list;;
exception Empty
let empty = [];;
let is_empty q = q = [];;
let enqueue x q = q @ [x];;
let dequeue q =
match q with
| [] -> raise Empty
| _ :: xs -> xs;;
let dequeue_opt q =
match q with
| [] -> None
| _ :: xs -> Some xs;;
let front q =
match q with
| [] -> raise Empty
| x :: _ -> x;;
let front_opt q =
match q with
| [] -> None
| x :: _ -> Some x;;
let length q =
List.length q;;
let of_list l = l;;
let to_list q = q;;