lean-ja / lean-ja/lean-by-example
デフォルト引数 ・オプション引数?の使用例
Open
Nobody has claimed this yet.
コード例
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
ふつうは指定したくないけど、いざとなれば簡単に変更できるという感じ。
def IO.randFloat (lo hi : Float) (base := 10000000) : IO Float := do
-- `0`以上`1`未満の乱数を生成する
let r := (← IO.rand 0 base : Float) / (base : Float)
return (hi - lo) * r + lo
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Lean example section covering function arguments and review how nearby examples are organized. Add a clear example explaining a default argument that is normally omitted but can be overridden, using the IO.randFloat example from the issue; done when the usage and override behavior are understandable from the documentation.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100