Finished Chapter 4

This commit is contained in:
WGAVermeer
2026-03-10 13:05:37 +01:00
parent 059f9724c4
commit 61da31dcdc
5 changed files with 364 additions and 0 deletions

9
chap_4/e4_5.dfy Normal file
View File

@@ -0,0 +1,9 @@
datatype Tree<T> = Leaf(data: T)
| Node(left: Tree<T>, right: Tree<T>)
function Mirror<T>(t: Tree<T>): Tree<T> {
match t
case Leaf(_) => t
case Node(left, right) => Node(Mirror(right), Mirror(left))
}