Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
カリー化入門 / currying
Search
Nishimura Yuki
July 26, 2019
Programming
67
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
130
モンスターマシンを起こすBotを作った話 / wake up bot
ni5h1
0
42
Other Decks in Programming
See All in Programming
R8 の設定見直しでアプリサイズ削減
andpad
0
210
Java 27新機能 / Java 27 new features
kishida
2
220
Simple Storage Service(S3) is not simple
iwatsukayura
0
250
すこし踏み込む CancellationToken
htkym
2
1.7k
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
960
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
160
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
140
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
140
Jetpack Compose Mechanisms
skydoves
2
710
気持ちぃ〜角丸 Squircle
ryu1013
0
240
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.1k
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Deep Space Network (abreviated)
tonyrice
0
360
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
320
A better future with KSS
kneath
240
18k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
480
The Cost Of JavaScript in 2023
addyosmani
55
10k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
790
Code Reviewing Like a Champion
maltzj
529
40k
Building AI with AI
inesmontani
PRO
1
1.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
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' 関数をカリー化する関数
ご清聴ありがとう ございました