local Rx = require 'Rx'

local Observable = Rx.Observable

local observableNever = Observable.never

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

local function amb(previous, current)
    return previous:amb(current)
end

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

return function(...)

    local acc = observableNever()

    local items = { ... }

    for _, item in ipairs(items) do
        acc = amb(acc, item)
    end

    return acc

end
