@@ -280,41 +280,6 @@ function prefix_and_strip_contexts(::IsParent, ctx::AbstractContext, vn::VarName
280280 return vn, setchildcontext (ctx, new_ctx)
281281end
282282
283- """
284- prefix(model::Model, x::VarName)
285- prefix(model::Model, x::Val{sym})
286- prefix(model::Model, x::Any)
287-
288- Return `model` but with all random variables prefixed by `x`, where `x` is either:
289- - a `VarName` (e.g. `@varname(a)`),
290- - a `Val{sym}` (e.g. `Val(:a)`), or
291- - for any other type, `x` is converted to a Symbol and then to a `VarName`. Note that
292- this will introduce runtime overheads so is not recommended unless absolutely
293- necessary.
294-
295- # Examples
296-
297- ```jldoctest
298- julia> using DynamicPPL: prefix
299-
300- julia> @model demo() = x ~ Dirac(1)
301- demo (generic function with 2 methods)
302-
303- julia> rand(prefix(demo(), @varname(my_prefix)))
304- (var"my_prefix.x" = 1,)
305-
306- julia> rand(prefix(demo(), Val(:my_prefix)))
307- (var"my_prefix.x" = 1,)
308- ```
309- """
310- prefix (model:: Model , x:: VarName ) = contextualize (model, PrefixContext (x, model. context))
311- function prefix (model:: Model , x:: Val{sym} ) where {sym}
312- return contextualize (model, PrefixContext (VarName {sym} (), model. context))
313- end
314- function prefix (model:: Model , x)
315- return contextualize (model, PrefixContext (VarName {Symbol(x)} (), model. context))
316- end
317-
318283"""
319284
320285 ConditionContext{Values<:Union{NamedTuple,AbstractDict},Ctx<:AbstractContext}
0 commit comments