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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Understanding Apache Lucene - More than just full-text search
spinscale
0
130
[SF Ruby Feb'26] The Silicon Heel
palkan
0
110
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
モダンOBSプラグイン開発
umireon
0
160
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
260
PHPで TLSのプロトコルを実装してみる
higaki_program
0
240
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
260
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
140
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
760
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
330
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
250
Featured
See All Featured
Marketing to machines
jonoalderson
1
5k
Discover your Explorer Soul
emna__ayadi
2
1.1k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Utilizing Notion as your number one productivity tool
mfonobong
4
260
Why Our Code Smells
bkeepers
PRO
340
58k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
990
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
89
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
210
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
400
Are puppies a ranking factor?
jonoalderson
1
3.1k
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' 関数をカリー化する関数
ご清聴ありがとう ございました