Allow users to specify the output eltype of map#116
Open
MasonProtter wants to merge 1 commit intoJuliaGizmos:masterfrom
Open
Allow users to specify the output eltype of map#116MasonProtter wants to merge 1 commit intoJuliaGizmos:masterfrom
map#116MasonProtter wants to merge 1 commit intoJuliaGizmos:masterfrom
Conversation
MasonProtter
commented
Aug 7, 2024
Comment on lines
-152
to
+159
| @test occursin("Observable(5)\n 0 => identity(x) in Base at operators.jl", plain(obs)) | ||
| @test occursin("Observable(5)\n 0 => identity(x)", plain(obs)) | ||
| @test string(f) == "ObserverFunction `identity` operating on Observable(5)" | ||
| f = on(x->nothing, obs); ln = @__LINE__ | ||
| str = plain(obs) | ||
| @test occursin("Observable(5)", str) | ||
| @test occursin("0 => identity(x) in Base at operators.jl", str) | ||
| @test occursin(" in Main at $(@__FILE__)", str) | ||
| @test occursin("0 => identity(x)", str) | ||
| @test occursin(" Main", str) | ||
| @test occursin("runtests.jl", str) |
Author
There was a problem hiding this comment.
I had to weaken these tests because the printing of this sort of thing has changed on v1.11, and it was causing the tests to fail.
|
Perhaps also look at https://github.com/ReactiveBayes/Rocket.jl which already provides this functionality, see here |
Member
|
So, I think we specifically had: o1 = Observable{Any}(true);
o2 = map!(Observable{Any}(), o1) do x
@info "Updating o2 from o1" x
x + 1
endFor this pattern, which I think is nicer than a keyword argument? |
Author
|
I find that pattern a lot more annoying to write than using a keyword personally, and second of all, that pattern doesn't cover the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The way
mapcurrently works is that when you map over an Observable, theeltypeof the newObservableis determined by the first application of the mapping function, i.e.This PR keeps the current default behaviour, but adds a kwarg with two new options
out_type = :inferand
out_type::Type: