@@ -58,16 +58,17 @@ DynamicTransformationContext{true}()
58
58
setchildcontext
59
59
60
60
"""
61
- leafcontext(context)
61
+ leafcontext(context::AbstractContext )
62
62
63
63
Return the leaf of `context`, i.e. the first descendant context that `IsLeaf`.
64
64
"""
65
- leafcontext (context) = leafcontext (NodeTrait (leafcontext, context), context)
66
- leafcontext (:: IsLeaf , context) = context
67
- leafcontext (:: IsParent , context) = leafcontext (childcontext (context))
65
+ leafcontext (context:: AbstractContext ) =
66
+ leafcontext (NodeTrait (leafcontext, context), context)
67
+ leafcontext (:: IsLeaf , context:: AbstractContext ) = context
68
+ leafcontext (:: IsParent , context:: AbstractContext ) = leafcontext (childcontext (context))
68
69
69
70
"""
70
- setleafcontext(left, right)
71
+ setleafcontext(left::AbstractContext , right::AbstractContext )
71
72
72
73
Return `left` but now with its leaf context replaced by `right`.
73
74
@@ -103,19 +104,21 @@ julia> # Append another parent context.
103
104
ParentContext(ParentContext(ParentContext(DefaultContext())))
104
105
```
105
106
"""
106
- function setleafcontext (left, right)
107
+ function setleafcontext (left:: AbstractContext , right:: AbstractContext )
107
108
return setleafcontext (
108
109
NodeTrait (setleafcontext, left), NodeTrait (setleafcontext, right), left, right
109
110
)
110
111
end
111
- function setleafcontext (:: IsParent , :: IsParent , left, right)
112
+ function setleafcontext (
113
+ :: IsParent , :: IsParent , left:: AbstractContext , right:: AbstractContext
114
+ )
112
115
return setchildcontext (left, setleafcontext (childcontext (left), right))
113
116
end
114
- function setleafcontext (:: IsParent , :: IsLeaf , left, right)
117
+ function setleafcontext (:: IsParent , :: IsLeaf , left:: AbstractContext , right:: AbstractContext )
115
118
return setchildcontext (left, setleafcontext (childcontext (left), right))
116
119
end
117
- setleafcontext (:: IsLeaf , :: IsParent , left, right) = right
118
- setleafcontext (:: IsLeaf , :: IsLeaf , left, right) = right
120
+ setleafcontext (:: IsLeaf , :: IsParent , left:: AbstractContext , right:: AbstractContext ) = right
121
+ setleafcontext (:: IsLeaf , :: IsLeaf , left:: AbstractContext , right:: AbstractContext ) = right
119
122
120
123
"""
121
124
DynamicPPL.tilde_assume!!(
0 commit comments