local Rx = require 'Rx'

local Scheduler = Rx.Scheduler
local observableFrom = Rx.Observable.from
local observableConcat = Rx.Observable.concat

--------------------------------------------------------------------------------

return function(self, ...)

    local values
    local scheduler = ...

    if Scheduler:isClassOf(scheduler) then
        values = { length = select('#', ...)-1, select(2, ...) }
    else
        values = { length = select('#', ...), ... }
        scheduler = Scheduler.currentThread()
    end

    return observableConcat(observableFrom(values, nil, scheduler), self)

end
