Skip to content

Commit 0ae98f0

Browse files
committed
Change field order of Bind and improve docs.
1 parent ecf1fa0 commit 0ae98f0

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/combinators/bind.jl

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
"""
2+
struct MeasureBase.Bind{M,K} <: AbstractMeasure
3+
4+
Represents a monatic bind. User code should create instances of `Bind`
5+
directly, but should call `mbind(k, μ)` instead.
6+
"""
17
struct Bind{M,K} <: AbstractMeasure
2-
μ::M
38
k::K
9+
μ::M
10+
end
11+
12+
getdof(d::Bind) = NoDOF{typeof(d)}()
13+
14+
function Base.rand(rng::AbstractRNG, ::Type{T}, d::Bind) where {T}
15+
x = rand(rng, T, d.μ)
16+
y = rand(rng, T, d.k(x))
17+
return y
418
end
519

620

@@ -25,11 +39,5 @@ unavailable in Julia.
2539
end
2640
```
2741
"""
28-
mbind(k, μ) = Bind(μ, k)
42+
mbind(k, μ) = Bind(k, μ)
2943
export mbind
30-
31-
function Base.rand(rng::AbstractRNG, ::Type{T}, d::Bind) where {T}
32-
x = rand(rng, T, d.μ)
33-
y = rand(rng, T, d.k(x))
34-
return y
35-
end

0 commit comments

Comments
 (0)