Helper utilities

ReactiveMP implements various structures/functions/methods as "helper" structures that might be useful in various contexts.

ReactiveMP.SkipIndexIteratorType
SkipIndexIterator

A special type of iterator that simply iterates over internal iterator, but skips index skip.

Arguments

  • iterator: internal iterator
  • skip: index to skip (integer)

See also: skipindex

source
ReactiveMP.skipindexFunction
skipindex(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

source
ReactiveMP.MacroHelpers.proxy_typeFunction
proxy_type(proxy, type)

Returns a type wrapped with a proxy type in a form of ProxyType{ <: Type }.

Arguments

  • proxy: Proxy type used to wrap type
  • type: Type to be wrapped
source
ReactiveMP.MacroHelpers.@proxy_methodsMacro
@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))
source
ReactiveMP.MacroHelpers.upper_typeFunction
upper_type(type)

This function returns Type{ <: T } expression for the following input expressions:

  1. typeof(T)
  2. Type{ <: T }
  3. Type{ T }
  4. T

Arguments

  • type: Type expression to be extended
source
ReactiveMP.MacroHelpers.bottom_typeFunction
bottom_type(type)

This function returns T expression for the following input expressions:

  1. typeof(T)
  2. Type{ <: T }
  3. Type{ T }
  4. T

Arguments

  • type: Type expression to be lowered
source