From c86d76fff04b72a642cbedb42caea8f25f535435 Mon Sep 17 00:00:00 2001 From: Claudio Russo Date: Wed, 21 Feb 2024 17:30:38 +0000 Subject: [PATCH] doc: update `List.mo` (#616) Fix bugs is doc comments --- src/List.mo | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/List.mo b/src/List.mo index de200f22..10369a8f 100644 --- a/src/List.mo +++ b/src/List.mo @@ -169,7 +169,9 @@ module { /// /// Runtime: O(size) /// - /// Space: O(1) + /// Space: O(size) + /// + /// *Runtime and space assumes that `f` runs in O(1) time and space. public func iterate(l : List, f : T -> ()) { switch l { case null { () }; @@ -234,6 +236,8 @@ module { /// Runtime: O(size) /// /// Space: O(size) + /// + /// *Runtime and space assumes that `f` runs in O(1) time and space. public func partition(l : List, f : T -> Bool) : (List, List) { switch l { case null { (null, null) }; @@ -270,6 +274,8 @@ module { /// Runtime: O(size) /// /// Space: O(size) + /// + /// *Runtime and space assumes that `f` runs in O(1) time and space. public func mapFilter(l : List, f : T -> ?U) : List { switch l { case null { null }; @@ -749,7 +755,7 @@ module { /// /// Space: O(min(size(xs), size(ys))) /// - /// *Runtime and space assumes that `zip` runs in O(1) time and space. + /// *Runtime and space assumes that `f` runs in O(1) time and space. public func zipWith( xs : List, ys : List, @@ -781,8 +787,6 @@ module { /// Runtime: O(n) /// /// Space: O(n) - /// - /// *Runtime and space assumes that `zip` runs in O(1) time and space. public func split(n : Nat, xs : List) : (List, List) { if (n == 0) { (null, xs) } else { func rec(n : Nat, xs : List) : (List, List) { @@ -820,8 +824,6 @@ module { /// Runtime: O(size) /// /// Space: O(size) - /// - /// *Runtime and space assumes that `zip` runs in O(1) time and space. public func chunks(n : Nat, xs : List) : List> { let (l, r) = split(n, xs); if (isNil(l)) {