Lifting functions with multiple return values

I want to lift a function with multiple return values such that each return value is an observable. Below is an example which makes an observable pair, instead, as I wish, a pair of observables.

julia> z = Observable(3 + 4im)
Observable(3 + 4im)


julia> @lift reim($z)
Observable((3, 4))

Perhaps not really an answer to what is the correct library implementation. But as a workaround, something like:

splitobs(o::Observable{Tuple{}}) = ()
splitobs(o::Observable{<:Tuple}) = (lift(first, o), splitobs(lift(Base.tail, o))...)

might work:

julia> rpart, ipart = splitobs(@lift reim($z))
(Observable(3), Observable(4))
2 Likes