Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
名前付き引数を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasawher committed Mar 29, 2024
1 parent 6d23aaa commit 234d412
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Src/NamedArgument.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/-
# 名前付き引数
Lean では,関数に引数を渡すときに順序ではなく名前で引数を指定することができます.
-/

-- `foldl` には `init` という名前の引数がある
#check List.foldl

-- 本来は最初の引数は関数だが,
#eval [1, 2, 3, 4].foldl (· + ·) 0

-- 名前付き引数を使うと,引数の順序を変えることができる
#eval [1, 2, 3, 4].foldl (init := 0) (· + ·)
3 changes: 2 additions & 1 deletion md/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@

* [コメント](./Comment.md)
* [ドット記法](./build/DotNotation.md)
* [パイプライン演算子](./build/Pipeline.md)
* [パイプライン演算子](./build/Pipeline.md)
* [名前付き引数](./build/NamedArgument.md)

0 comments on commit 234d412

Please sign in to comment.