Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
カリー化入門 / currying
Search
Nishimura Yuki
July 26, 2019
Programming
61
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
カリー化入門 / currying
あくあたん工房2019年7月部会のLTです
Nishimura Yuki
July 26, 2019
More Decks by Nishimura Yuki
See All by Nishimura Yuki
特に作りたいものがない人のためのプログラミング入門
ni5h1
0
110
モンスターマシンを起こすBotを作った話 / wake up bot
ni5h1
0
35
Other Decks in Programming
See All in Programming
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
120
仕様駆動開発の消費期限
watany
20
9.2k
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
230
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
460
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
340
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
170
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.4k
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
260
Cloudflare is Agents
chimame
0
190
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
120
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
500
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
130
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
500
The Pragmatic Product Professional
lauravandoore
37
7.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
230
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.6k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
520
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Marketing to machines
jonoalderson
1
5.7k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.1k
The Invisible Side of Design
smashingmag
301
52k
Designing Experiences People Love
moore
143
24k
Transcript
カリー化入門 2019年あくあたん工房7月部会
そもそも カリー化って何?
カリー化 (currying, カリー化された =curried) とは、複数の引数をとる関数 を、引数が「もとの関数の最初の引 数」で戻り値が「もとの関数の残りの 引数を取り結果を返す関数」であるよ うな関数にすること(あるいはその関 数のこと)である。
出典:ウィキペディア
つまり、
N個の引数をとる関数 一引数を取る関数のチェイン
具体例
𝑓: 𝑥 → 𝑦 関数が引数を一つのみとる つまり、 すでにカリー化されている 引数を1個とる関数の場合
𝑓: 𝑥, 𝑦 → 𝑧 ↓ 𝑔: 𝑥 → (ℎ:
𝑦 → 𝑧) 引数を2個とる関数の場合
𝑓: 𝑥, 𝑦, 𝑧 → 𝑢 ↓ 𝑔: 𝑥 →
(ℎ: 𝑦 → (𝑖: 𝑧 → 𝑢)) 引数を3個とる関数の場合
何が うれしいの?
具体例として, 2つの引数の合計を返す関数f(x, y) をmap関数に渡す場合を考える
カリー化 されていないとき
func f(x,y) int { return x + y } func
g(x) int { return f(1, x) } list2 = map(g, list1)
カリー化 されているとき
func f(x,y) int { return x + y } list2
= map(g(1), list1)
部分適用で よくね
できることは同じ
func f(x,y) int { return x + y } g
= partial(f, 1) list2 = map(g, list1)
おまけ Pythonでカリー化
>>> currying.f("a")("b")("c") 'abc' カリー化されてる関数
>>> currying.f("a")("b")("c") 'abc' 関数をカリー化する関数
ご清聴ありがとう ございました