Skip to content

Commit d2c7b74

Browse files
committed
update docstring
1 parent ba08cc9 commit d2c7b74

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

src/macros.jl

+10-20
Original file line numberDiff line numberDiff line change
@@ -66,30 +66,20 @@ end
6666
The <declaration> gives a measure and its default parameters, and specifies
6767
its relation to its base measure. For example,
6868
69-
@measure Normal(μ,σ) ≃ Lebesgue{X}
69+
@measure Normal(μ,σ)
7070
71-
declares the `Normal` is a measure with default parameters `μ and σ`, and it is
72-
equivalent to its base measure, which is `Lebesgue{X}`
71+
declares the `Normal` is a measure with default parameters `μ and σ`. The result is equivalent to
72+
```
73+
struct Normal{N,T} <: ParameterizedMeasure{N}
74+
par :: NamedTuple{N,T}
75+
end
7376
74-
You can see the generated code like this:
77+
KeywordCalls.@kwstruct Normal(μ,σ)
7578
76-
julia> MacroTools.prettify(@macroexpand @measure Normal(μ,σ) ≃ Lebesgue{X})
77-
quote
78-
struct Normal{P, X} <: AbstractMeasure
79-
par::P
80-
end
81-
function Normal(nt::NamedTuple)
82-
P = typeof(nt)
83-
return Normal{P, eltype(Normal{P})}
84-
end
85-
Normal(; kwargs...) = Normal((; kwargs...))
86-
(basemeasure(μ::Normal{P, X}) where {P, X}) = Lebesgue{X}
87-
Normal(μ, σ) = Normal(; Any[:μ, :σ])
88-
((:≪)(::Normal{P, X}, ::Lebesgue{X}) where {P, X}) = true
89-
((:≪)(::Lebesgue{X}, ::Normal{P, X}) where {P, X}) = true
90-
end
79+
Normal(μ,σ) = Normal((μ=μ, σ=σ))
80+
```
9181
92-
Note that the `eltype` function needs to be defined separately by the user.
82+
See [KeywordCalls.jl](https://github.com/cscherrer/KeywordCalls.jl) for details on `@kwstruct`.
9383
"""
9484
macro measure(expr)
9585
esc(_measure(expr))

0 commit comments

Comments
 (0)