return function(source, timeSpan, count, scheduler)
    return source:windowWithTimeOrCount(timeSpan, count, scheduler)
        :flatMap(function(window)
            return window:toArray()
        end)
end
