out =
colon (lo, hi)
¶out =
colon (hi, inc, hi)
¶Generate a sequence of uniformly-spaced values.
This method implements the behavior for the colon operator (lo:hi
or
lo:inc:hi
calls) for the datetime type.
"Uniformly-spaced" means uniform in terms of the duration or calendarDuration value used as the increment. Calendar durations are not necessarily equal-sized in terms of the amount of actual time contained in them, so when using a calendarDuration as the increment, the resulting vector may not be, and often will not be, uniformly spaced in terms of actual (non-"calendar") time.
The inc argument may be a duration, calendarDuration, or numeric. Numerics
are taken to be a number of days (uniform-size days, not calendar days), and are
converted to a duration object with duration.ofDays (inc)
. The default value
for inc, used in the two-arg lo:hi
is 1, that is, 1 day of exactly 24
hours.
Returns a datetime vector.
WARNING: There are issues with negative-direction sequences. When hi is less than lo, this will always produce an empty array, even if inc is a negative value. And there are cases with calendarDurations that have both Months, Days and/or Times with mixed signs that values may move in the "wrong" direction, or produce an infinite loop. If these problem cases can be correctly identified, but not corrected, those cases may raise an error future releases of Tablicious.