Default true
.
When true
, the original order is preserved.
Elements are compared by their order in the base collection, not by their intrinsic value or comparability.
var xs = [1, 1, 2]
var cxs = new CombinationCollection[Int](xs, 2)
cxs.are_sorted = true
assert cxs.to_a == [[1,1], [1,2], [1, 2]]
cxs.are_sorted = false
assert cxs.to_a == [[1,1], [1,2], [1, 1], [1, 2], [2, 1], [2, 1]]
# Are the elements in the generated sequences sorted?
# Default `true`.
#
# When `true`, the original order is preserved.
#
# Elements are compared by their order in the base collection,
# not by their intrinsic value or comparability.
#
# ~~~~
# var xs = [1, 1, 2]
# var cxs = new CombinationCollection[Int](xs, 2)
# cxs.are_sorted = true
# assert cxs.to_a == [[1,1], [1,2], [1, 2]]
# cxs.are_sorted = false
# assert cxs.to_a == [[1,1], [1,2], [1, 1], [1, 2], [2, 1], [2, 1]]
# ~~~~
var are_sorted = true is writable
lib/combinations/combinations.nit:251,2--267,34