restructure + lecutre 07

This commit is contained in:
SowinskiBraeden committed 2026-02-19 11:59:58 -08:00
1 parent b8c19aa341
commit 7c3198fee4
96 files changed
+458 -4

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;;