Skip to content

review: Add TODOs to pure/List (ignore for merging) #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crusso
Copy link
Contributor

@crusso crusso commented Feb 28, 2025

I took pass through pure List and added immediate and future TODOs.
The immediate ones are regressions vs base and I think should be fixed ASAP.

Others, marked future are for us to revisit at leisure (existing flaws we can fix later)

@crusso crusso requested a review from a team as a code owner February 28, 2025 12:13
@crusso crusso changed the title Add TODOs to pure/List. review: Add TODOs to pure/List. Feb 28, 2025
@crusso crusso requested a review from ggreif February 28, 2025 12:13
Copy link

✨ Documentation preview for 7798a18:

https://dfinity.github.io/new-motoko-base/pull/195 (source code)

@ggreif
Copy link
Contributor

ggreif commented Feb 28, 2025

See #189. Containing some corrections. And more tests.

@@ -584,6 +597,7 @@ module {
/// Space: O(n)
///
/// *Runtime and space assumes that `f` runs in O(1) time and space.
// TODO: now: make TR - was TR in base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in #189

@@ -616,6 +630,7 @@ module {
/// Runtime: O(n)
///
/// Space: O(n)
// TODO: now: make TR - was TR in base (see replicate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in #189

@@ -797,6 +817,7 @@ module {
/// Runtime: O(size)
///
/// Space: O(size)
// TODO: make TR was TR in base
Copy link
Contributor

@ggreif ggreif Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only see toIter in legacy base, maybe named differently?

Found it: Iter.toList

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fixed in #189

@@ -797,6 +817,7 @@ module {
/// Runtime: O(size)
///
/// Space: O(size)
// TODO: make TR was TR in base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO: make TR was TR in base
// TODO: now: make TR - was TR in base

@@ -302,11 +309,13 @@ module {
/// Runtime: O(size(l))
///
/// Space: O(size(l))
// TODO: now make TR - append was TR in base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO: now make TR - append was TR in base
// TODO: now: make TR - `append` was TR in base

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fixed in #189 too

public func concat<T>(list1 : List<T>, list2 : List<T>) : List<T> = switch list1 {
case null list2;
case (?(h, t)) ?(h, concat(t, list2))
};

// TODO: documentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added in #189

@@ -530,6 +541,7 @@ module {
/// Space: O(1)
///
/// *Runtime and space assumes that `equalFunc` runs in O(1) time and space.
// TODO: rename equalFunc equalItem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in #189

@@ -554,6 +566,7 @@ module {
/// Space: O(1)
///
/// *Runtime and space assumes that argument `compare` runs in O(1) time and space.
// TODO: rename compare compareItem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in #189

@@ -8,6 +8,8 @@
/// import List "mo:base/List";
/// ```

// TODO: future: all examples are meant to be self-contained actors, don't include common code either.
// TODO: future: many switches test for incommon null case first - reorder for perf.
Copy link
Contributor

@ggreif ggreif Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was doing this reordering on the fly

@crusso crusso changed the title review: Add TODOs to pure/List. review: Add TODOs to pure/List (ignore for merging) Feb 28, 2025
@@ -254,6 +259,7 @@ module {
/// Space: O(size)
///
/// *Runtime and space assumes that `f` runs in O(1) time and space.
// TODO: now: make TR - was TR in base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also fixed in #189 (with test added)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants