lean-ja / lean-ja/lean-by-example
HMul の実装例:リストのスカラー倍
Open
Nobody has claimed this yet.
メモ
型クラス
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
def A := [1, 2, 3, 4, 5]
-- we cannot perform scalar multiplication...
#check_failure 2 * A
variable {α : Type} [Mul α]
instance : HMul α (List α) (List α) where
hMul (x : α) (xs : List α) := xs.map (x * ·)
-- works!!
#check 2 * A
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
The issue only provides a Lean snippet and does not name a file, test, or requested change. First identify where this example belongs in the mdBook, then verify the documented HMul example and its #check and #check_failure behavior.
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
- Needs clarification
- Newbie friendliness
- 25/100