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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Nishimura Yuki
July 26, 2019
Programming
0
54
カリー化入門 / 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
29
Other Decks in Programming
See All in Programming
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
180
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
180
Sekiban + Microsoft Orleans のアクターをAWS対応しました / Sekiban + Microsoft Orleans actors are now supported on AWS.
tomohisa
0
110
Swift at Scale: Where Performance Really Comes From
kateinoigakukun
0
110
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
330
ぼくの開発環境2026
yuzneri
0
270
Python’s True Superpower
hynek
0
160
生成AIを活用したソフトウェア開発ライフサイクル変革の現在値
hiroyukimori
PRO
0
120
Claude Codeと2つの巻き戻し戦略 / Two Rewind Strategies with Claude Code
fruitriin
0
160
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
300
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
320
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
290
Featured
See All Featured
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
WENDY [Excerpt]
tessaabrams
9
36k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
130
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
260
The Mindset for Success: Future Career Progression
greggifford
PRO
0
240
How to build a perfect <img>
jonoalderson
1
4.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
160
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' 関数をカリー化する関数
ご清聴ありがとう ございました