Lazy and efficient 'range' iterables to generate values based on start, stop and step/count.
for (final i in 0.to(5)) {
print(i);
}
Range a length from [0, n) with step 1:
// int n = 10; // Some length n
for (final i in n.range) {
print(i);
}
// int n = 10; // Some length n
for (final i in n.take(10)) {
print(i);
}
Ranges can also be descending:
for (final i in 5.to(-5)) {
print(i);
}
IntRange.linspace
returns an Iterable<int>
with range [start, stop] with [count] elements in it.
print(1.linspace(10, 5));
print(TimeRange(
DateTime(2019, 1, 1), DateTime(2019, 1, 20), Duration(days: 1)));
print(MonthRange(DateTime(2020, 2, 29), DateTime(2032, 2, 30), 6));
print(ticks(-100, 1000000, 10));
// => [-100000, 0, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000]
print(List.generate(11, (i) => i * 10).findExtent()); // => Extent(0, 100)
print(Extent(5, 50).range(5));
print(Extent(5, 50).rands(100));
final extents = List.generate(11, (i) => i * 10).edgesToExtents();
final data = extents.rands(20)!;
print(extents.computeBins(data));
final extents = List.generate(11, (i) => i * 10).edgesToExtents();
final data = extents.rands(20)!;
print(extents.computeCounts(data));
final extents = List.generate(11, (i) => i * 10).edgesToExtents();
final data = extents.rands(20)!;
print(extents.computeHistogram(data));