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
0
56
カリー化入門 / currying
あくあたん工房2019年7月部会のLTです
Nishimura Yuki
July 26, 2019
Tweet
Share
More Decks by Nishimura Yuki
See All by Nishimura Yuki
特に作りたいものがない人のためのプログラミング入門
ni5h1
0
100
モンスターマシンを起こすBotを作った話 / wake up bot
ni5h1
0
31
Other Decks in Programming
See All in Programming
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
160
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
Understanding Apache Lucene - More than just full-text search
spinscale
0
130
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
220
AHC061解説
shun_pi
0
400
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
230
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
150
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
250
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
310
Claude Codeログ基盤の構築
giginet
PRO
7
3.5k
AI 開発合宿を通して得た学び
niftycorp
PRO
0
150
Featured
See All Featured
Practical Orchestrator
shlominoach
191
11k
Prompt Engineering for Job Search
mfonobong
0
200
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.5k
Fireside Chat
paigeccino
42
3.8k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
770
Automating Front-end Workflow
addyosmani
1370
200k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Balancing Empowerment & Direction
lara
5
950
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
100
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
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' 関数をカリー化する関数
ご清聴ありがとう ございました