Helper utilities
ReactiveMP
implements various structures/functions/methods as "helper" structures that might be useful in various contexts.
ReactiveMP.SkipIndexIterator
— TypeSkipIndexIterator
A special type of iterator that simply iterates over internal iterator
, but skips index skip
.
Arguments
iterator
: internal iteratorskip
: index to skip (integer)
See also: skipindex
ReactiveMP.skipindex
— Functionskipindex(iterator, skip)
Creation operator for SkipIndexIterator
.
julia> s = ReactiveMP.skipindex(1:3, 2)
2-element ReactiveMP.SkipIndexIterator{Int64, UnitRange{Int64}}:
1
3
julia> collect(s)
2-element Vector{Int64}:
1
3
See also: SkipIndexIterator
ReactiveMP.MacroHelpers.proxy_type
— Functionproxy_type(proxy, type)
Returns a type wrapped with a proxy type in a form of ProxyType{ <: Type }
.
Arguments
proxy
: Proxy type used to wraptype
type
: Type to be wrapped
ReactiveMP.MacroHelpers.ensure_symbol
— Functionensure_symbol(input)
This function ensures that the given argument has a Symbol type
ReactiveMP.MacroHelpers.@proxy_methods
— Macro@proxy_methods(proxy_type, proxy_getter, proxy_methods)
Generates proxy methods for a specified proxy_type
using proxy_getter
. For example:
@proxy_methods Message getdata [
Distributions.mean,
Distributions.var
]
generates:
Distributions.mean(proxy::Message) = Distributions.mean(getdata(proxy))
Distributions.var(proxy::Message) = Distributions.mean(getdata(proxy))
ReactiveMP.MacroHelpers.upper_type
— Functionupper_type(type)
This function returns Type{ <: T }
expression for the following input expressions:
- typeof(T)
- Type{ <: T }
- Type{ T }
- T
Arguments
type
: Type expression to be extended
ReactiveMP.MacroHelpers.bottom_type
— Functionbottom_type(type)
This function returns T
expression for the following input expressions:
- typeof(T)
- Type{ <: T }
- Type{ T }
- T
Arguments
type
: Type expression to be lowered