Skip to content

Commit

Permalink
PersistentOrderedMap: clean up comments + formatting typo
Browse files Browse the repository at this point in the history
  • Loading branch information
GoPavel committed Oct 24, 2024
1 parent 5235ff3 commit 9a0a264
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/PersistentOrderedMap.mo
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ import List "List";
import Nat "Nat";
import O "Order";

// TODO: a faster, more compact and less indirect representation would be:
// type Map<K, V> = {
// #red : (Map<K, V>, K, V, Map<K, V>);
// #black : (Map<K, V>, K, V, Map<K, V>);
// #leaf
//};
// (this inlines the colors into the variant, flattens a tuple, and removes a (now) redundant option, for considerable heap savings.)
// It would also make sense to maintain the size in a separate root for 0(1) access.

module {

/// Red-black tree of nodes with key-value entries, ordered by the keys.
Expand All @@ -54,7 +45,7 @@ module {
///
/// `MapOps` contains methods that require `compare` internally:
/// operations that may reshape a `Map` or should find something.
public class MapOps<K>(compare : (K,K) -> O.Order) {
public class MapOps<K>(compare : (K, K) -> O.Order) {

/// Returns a new map, containing all entries given by the iterator `i`.
/// If there are multiple entries with the same key the last one is taken.
Expand Down Expand Up @@ -698,7 +689,7 @@ module {
(#red (l, x, y, r))
};
case _ {
Debug.trap "RBTree.red"
Debug.trap "PersistentOrderedMap.red"
}
}
};
Expand Down

0 comments on commit 9a0a264

Please sign in to comment.