From 0da40c4ea9c4e16c8ffd52aeb02b91f7ed6eb2c5 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 15 Jan 2021 11:15:29 +0200 Subject: [PATCH] examples: use Empty instead of Leaf in tree_of_nodes.v --- examples/tree_of_nodes.v | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/tree_of_nodes.v b/examples/tree_of_nodes.v index 546ed23051..76d69a2f6d 100644 --- a/examples/tree_of_nodes.v +++ b/examples/tree_of_nodes.v @@ -1,6 +1,6 @@ -type Tree = Leaf | Node +type Tree = Empty | Node -struct Leaf {} +struct Empty {} struct Node { value int @@ -13,14 +13,14 @@ struct Node { // => it needs an explicit int(0) cast here: fn size(tree Tree) int { return match tree { - Leaf { int(0) } + Empty { int(0) } Node { 1 + size(tree.left) + size(tree.right) } } } fn main() { - node1 := Node{30, Leaf{}, Leaf{}} - node2 := Node{20, Leaf{}, Leaf{}} + node1 := Node{30, Empty{}, Empty{}} + node2 := Node{20, Empty{}, Empty{}} tree := Node{10, node1, node2} println('tree structure:\n $tree') println('tree size: ${size(tree)}')