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

+12
View File
@@ -0,0 +1,12 @@
(* we can impliment our own ref type *)
type 'a ref = { mutable contents: 'a };;
(* reference and dereference implimentation *)
let ref x = { contents = x };;
let (!) r = r.contents;;
(* assign to a mutable field *)
let (:=) r x = r.contents <- x;;
let incr r = r.contents <- r.contents + 1;;
let decr r = r.contents <- r.contents - 1;;