Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Doc style #25

Open
oyamad opened this issue Mar 8, 2017 · 6 comments
Open

Doc style #25

oyamad opened this issue Mar 8, 2017 · 6 comments
Assignees

Comments

@oyamad
Copy link
Member

oyamad commented Mar 8, 2017

See #1 (comment).

@shizejin
Copy link
Member

shizejin commented Mar 17, 2017

Documenter.jl is actually using what JuliaLang suggests.

To adopt this style, change

"""
Constructor of an N-player NormalFormGame, consisting of payoffs all 0.

##### Arguments

- `T::Type` : Type of payoff values; defaults to `Float64` if not specified.
- `nums_actions::NTuple{N,Int}` : Numbers of actions of the N players.

"""
function NormalFormGame{N}(T::Type, nums_actions::NTuple{N,Int})
    # TODO: can we still get inference to work but avoid the `::NTuple` below?
    players::NTuple{N,Player{N,T}} =
        ntuple(i -> Player(zeros(tuple(nums_actions[i:end]...,
                                       nums_actions[1:i-1]...))),
               N)
    return NormalFormGame{N,T}(players, nums_actions)
end

to

"""
    NormalFormGame{N}(T::Type, nums_actions::NTuple{N,Int})

Constructor of an N-player NormalFormGame, consisting of payoffs all 0.

# Arguments
* `T::Type`: Type of payoff values; defaults to `Float64` if not specified.
* `nums_actions::NTuple{N,Int}`: Numbers of actions of the N players.
"""
function NormalFormGame{N}(T::Type, nums_actions::NTuple{N,Int})
    # TODO: can we still get inference to work but avoid the `::NTuple` below?
    players::NTuple{N,Player{N,T}} =
        ntuple(i -> Player(zeros(tuple(nums_actions[i:end]...,
                                       nums_actions[1:i-1]...))),
               N)
    return NormalFormGame{N,T}(players, nums_actions)
end

@sglyon
Copy link
Member

sglyon commented Mar 17, 2017

That style looks good to me.

I would vote that we add a new line between the header # Arguments and the list.

Also, I prefer - to *, but since they are equivalent in markdown I'm happy either way

@oyamad
Copy link
Member Author

oyamad commented Mar 17, 2017

+1 for adding a new line between the header # Arguments and the list.

@shizejin
Copy link
Member

I agree. We don't need to follow the Julia suggested style strictly, as it won't make difference to the output of Documenter.jl, while make the raw docstrings much nicer.

@cc7768
Copy link
Member

cc7768 commented Mar 17, 2017

This all looks really good. Thanks @shizejin!

@oyamad oyamad mentioned this issue Apr 5, 2017
5 tasks
@shizejin
Copy link
Member

Two modifications to the doc style (discussed with @oyamad and @QBatista):

  1. Change * to - following Julia manual.
  2. Remove the type declarations from the header.
"""
    NormalFormGame{N}(T, nums_actions)

Constructor of an N-player NormalFormGame, consisting of payoffs all 0.

# Arguments
- `T::Type`: Type of payoff values; defaults to `Float64` if not specified.
- `nums_actions::NTuple{N,Int}`: Numbers of actions of the N players.
"""
function NormalFormGame{N}(T::Type, nums_actions::NTuple{N,Int})
    # TODO: can we still get inference to work but avoid the `::NTuple` below?
    players::NTuple{N,Player{N,T}} =
        ntuple(i -> Player(zeros(tuple(nums_actions[i:end]...,
                                       nums_actions[1:i-1]...))),
               N)
    return NormalFormGame{N,T}(players, nums_actions)
end

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants