Skip to content

Commit

Permalink
Merge branch 'master' into ryan/mops-publish-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanasa authored Feb 21, 2024
2 parents 3bfd2f6 + 4c2a90e commit ea476d8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mops.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/Array.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
14 changes: 8 additions & 6 deletions src/List.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(l : List<T>, f : T -> ()) {
switch l {
case null { () };
Expand Down Expand Up @@ -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<T>(l : List<T>, f : T -> Bool) : (List<T>, List<T>) {
switch l {
case null { (null, null) };
Expand Down Expand Up @@ -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<T, U>(l : List<T>, f : T -> ?U) : List<U> {
switch l {
case null { null };
Expand Down Expand Up @@ -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<T, U, V>(
xs : List<T>,
ys : List<U>,
Expand Down Expand Up @@ -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<T>(n : Nat, xs : List<T>) : (List<T>, List<T>) {
if (n == 0) { (null, xs) } else {
func rec(n : Nat, xs : List<T>) : (List<T>, List<T>) {
Expand Down Expand Up @@ -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<T>(n : Nat, xs : List<T>) : List<List<T>> {
let (l, r) = split<T>(n, xs);
if (isNil<T>(l)) {
Expand Down

0 comments on commit ea476d8

Please sign in to comment.