The ts_tscan structure
A ts_tscan structure allows you to look at no more than two time series elements at a time. It maintains a current scan position in the time series and has two element buffers for creating elements. An element fetched from a scan is overwritten after two ts_next() calls.
A ts_tscan structure is created with the ts_begin_scan() function and destroyed with the ts_end_scan() procedure.