module
VirtualTime::ArrayHelper
Defined in:
virtualtime.crClass Method Summary
-
.expand(list)
Expands ranges and other expandable types into a long list of all possible options.
-
.sorted?(list : Array(Int32)) : Bool
Returns whether
listis in ascending order.
Class Method Detail
def self.expand(list)
#
Expands ranges and other expandable types into a long list of all possible options. E.g. [1, 2..3, 4..5] gets expanded into [[1, 2, 4], [1,2, 5], [1,3,4], [1,3,5]]. Used only for convenience in tests.
def self.sorted?(list : Array(Int32)) : Bool
#
Returns whether list is in ascending order.
Used to skip allocating a sorted copy of a list that is already sorted,
which is the common case for hand-written rules like day: [1, 15].