From d81f55279b80aab24273d14a8e983b21dde76c34 Mon Sep 17 00:00:00 2001 From: Zen Voich Date: Wed, 21 Feb 2024 21:25:24 +0400 Subject: [PATCH 1/3] Add commit hash to `matchers` dependency (#621) --- mops.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mops.toml b/mops.toml index 09754eac..1f8e56e9 100644 --- a/mops.toml +++ b/mops.toml @@ -7,7 +7,7 @@ keywords = [ "base" ] license = "Apache-2.0" [dev-dependencies] -matchers = "https://github.com/kritzcreek/motoko-matchers#v1.3.0" +matchers = "https://github.com/kritzcreek/motoko-matchers#v1.3.0@3dac8a071b69e4e651b25a7d9683fe831eb7cffd" [toolchain] moc = "0.10.4" From c86d76fff04b72a642cbedb42caea8f25f535435 Mon Sep 17 00:00:00 2001 From: Claudio Russo Date: Wed, 21 Feb 2024 17:30:38 +0000 Subject: [PATCH 2/3] 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)) { From 4c2a90e772e83275157e51087ef11075d29f28b2 Mon Sep 17 00:00:00 2001 From: Ryan Vandersmith Date: Wed, 21 Feb 2024 10:35:01 -0700 Subject: [PATCH 3/3] Fix compiler warning in `Array.take()` method (#611) Fixes one of the compiler warnings mentioned in #610. --- src/Array.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Array.mo b/src/Array.mo index 1f207ba3..8d262b41 100644 --- a/src/Array.mo +++ b/src/Array.mo @@ -859,7 +859,7 @@ module { let len = Prim.abs(length); let size = array.size(); let resSize = if (len < size) { len } else { size }; - let start = if (length > 0) 0 else size - resSize; + let start : Nat = if (length > 0) 0 else size - resSize; subArray(array, start, resSize) } }