-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
By defining
Base.iterate(m::AbstractMeasure) = rand(m), nothing
Base.iterate(m::AbstractMeasure, ::Nothing) = rand(m), nothing
Base.Iterators.IteratorSize(::Type{<:AbstractMeasure}) = Base.IsInfinite()
we could make measures monadic in respect to Julia's iteration interface:
julia> using Base.Iterators, MeasureTheory
julia> take((x^2 for x in Normal()), 10) |> collect
10-element Vector{Float64}:
[...]
This would play well semantically with a syntax f.(μ)
for pushforward measures (#54).
x^2 for x in Normal
would become semantically equivalent to x ~ Normal(); return x^2
in a model.
Metadata
Metadata
Assignees
Labels
No labels