diff --git a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/examples/segment-tree2/index.md b/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/examples/segment-tree2/index.md index 3910aade..d1a9f066 100644 --- a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/examples/segment-tree2/index.md +++ b/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/examples/segment-tree2/index.md @@ -60,7 +60,7 @@ guard let Node(x, y) = z ```moonbit enum Data { - Data(~sum : Int, ~len : Int) + Data(sum~ : Int, len~ : Int) } derive(Show) enum LazyTag { @@ -70,7 +70,7 @@ enum LazyTag { enum Node { Nil - Node(~data : Data, ~tag : LazyTag, ~left : Node, ~right : Node) + Node(data~ : Data, tag~ : LazyTag, left~ : Node, right~ : Node) } derive(Show) ``` @@ -132,12 +132,12 @@ fn op_add(self : LazyTag, v : LazyTag) -> LazyTag { fn apply(self : Node, v : LazyTag) -> Node { match (self, v) { - (Node(data=Data(sum=a, len=length), ~tag, ~left, ~right), Tag(v) as new_tag) => + (Node(data=Data(sum=a, len=length), tag~, left~, right~), Tag(v) as new_tag) => Node( data=Data(sum=a + v * length, len=length), tag=tag + new_tag, - ~left, - ~right, + left~, + right~, ) (_, Nil) => self (Nil, _) => Nil @@ -163,7 +163,7 @@ fn modify( } else if modify_l <= l && modify_r >= r { self.apply(tag) } else { - guard let Node(~left, ~right, ..) = self + guard let Node(left~, right~, ..) = self left.apply(tag) + right.apply(tag) } } @@ -213,7 +213,7 @@ fn query(self : Node, l : Int, r : Int, query_l : Int, query_r : Int) -> Node { } else if query_l <= l && query_r >= r { self } else { - guard let Node(~tag, ~left, ~right, ..) = self + guard let Node(tag~, left~, right~, ..) = self let mid = (l + r) >> 1 left.apply(tag).query(l, mid, query_l, query_r) + right.apply(tag).query(mid + 1, r, query_l, query_r)