This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
generated from Seasawher/lean-book
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) (· + ·) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters