$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
カリー化入門 / currying
Search
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
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
160
How Software Deployment tools have changed in the past 20 years
geshan
0
28k
エディターってAIで操作できるんだぜ
kis9a
0
670
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
510
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
190
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
340
AIコーディングエージェント(Manus)
kondai24
0
150
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.2k
Level up your Gemini CLI - D&D Style!
palladius
1
180
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
12
7k
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
6.7k
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
150
Featured
See All Featured
How GitHub (no longer) Works
holman
316
140k
Documentation Writing (for coders)
carmenintech
76
5.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
A Tale of Four Properties
chriscoyier
162
23k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Designing Experiences People Love
moore
143
24k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
The Invisible Side of Design
smashingmag
302
51k
Typedesign – Prime Four
hannesfritz
42
2.9k
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' 関数をカリー化する関数
ご清聴ありがとう ございました