Oh, perfect. The @doc (@doc ) construction is exactly what I was looking 
for. Thanks!

On Tuesday, January 13, 2015 at 2:35:09 PM UTC-6, Mike Innes wrote:
>
> That should pretty much work as is, but you'll want to use the `doc""` 
> string macro for markdown formatting, i.e.
>
>     recursive_ols_doc = doc""" ....
>
> The other thing you can do is document one function, then retrieve that 
> functions docs with the @doc macro:
>
>     @doc "foo" ->
>     function recursive_ols() ...
>
>     @doc (@doc recursive_ols) ->
>     function recursive_ols!() ...
>
> On 13 January 2015 at 19:49, Gray Calhoun <gcal...@iastate.edu 
> <javascript:>> wrote:
>
>> Hi everyone, quick question about docstrings. Sometimes it makes sense
>> to use the same help text for different functions; I'm particularly
>> thinking mutating and non-mutating versions of the same algorithm. Is
>> there a natural way to reuse a docstring for different functions
>> (either in Docile.jl or in v0.4 base)?
>>
>> Specifically, I'm doing something like the following, but would prefer
>> to avoid the temporary variable `recursive_ols_doc` if possible (for
>> style reasons, if nothing else), and without writing the documentation in
>> a separate file.
>>
>> recursive_ols_doc = """
>>   Calculates the OLS estimators for the model y ~ x recursively...
>>   * `recursive_ols` is a wrapper that works like this...
>>   * `recursive_ols!` does all the real work like that...
>> """
>>
>> @doc recursive_ols_doc ->
>> function recursive_ols!(estimates::Array, y, x)
>>     ## Calculations
>> end
>>
>> @doc recursive_ols_doc ->
>> function recursive_ols(y, x, R::Integer)
>>     ## preallocate, then call recursive_ols!
>> end
>>
>> Thanks!
>>
>> (Really liking this documentation tool, btw)
>>
>
>

Reply via email to