lean-ja / lean-ja/lean-by-example
macro コマンドと macro_rules コマンドの違い: macro コマンドは終わるまで syntax を導入しない
Open
Nobody has claimed this yet.
メタプログラミング
宣言的コマンド
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
/- ## macro コマンドと macro_rules コマンドの違い
macro_rules コマンドは、展開の枝が一つしかなかったとしても、macro コマンドとは違っていて、
展開の右辺で左辺の宣言を使うことができる
-/
section
local syntax "my_repeat" tactic : tactic
local macro_rules
| `(tactic| my_repeat $t) => `(tactic| try ($t; my_repeat $t))
end
section
-- 右辺で宣言したばかりの `my_repeat` を使えない
-- macro コマンドが終わるまで syntax が登録されていないため
local macro "my_repeat" t:tactic : tactic => `(tactic| try $t; my_repeat $t)
end
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 from the Lean code example in the issue; no repository file or documentation section is specified. Determine where this explanation belongs, then ensure the documentation clearly explains when syntax becomes available for macro versus macro_rules and that the example is accurate.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100