/sorted.mo

Sorted Data Structures in Motoko

Primary LanguageMotokoApache License 2.0Apache-2.0

Sorted Data Structures

Data structures in which each element is sorted in numerical, alphabetical, or some other order.

Usage

let desc = Order.Descending(Nat.compare);
var l : SortedList.SortedList<Nat> = null;
l := SortedList.insert<Nat>(l, 0, desc);
l := SortedList.insert<Nat>(l, 1, desc);
// [1, 0];