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
Understanding Subtype in 5 Minutes
Search
Ryosuke TAKASHIMA
September 06, 2019
Programming
0
180
Understanding Subtype in 5 Minutes
Ryosuke TAKASHIMA
September 06, 2019
Tweet
Share
More Decks by Ryosuke TAKASHIMA
See All by Ryosuke TAKASHIMA
GCP native cloud migration
rst76
1
530
Cloud migration of the essential service
rst76
1
600
About purely functional language
rst76
0
140
performance-tuning-of-the-microservice.pdf
rst76
0
1.6k
red-black-tree.pdf
rst76
0
91
Fun of Types
rst76
0
56
Embedded Probabilistic Programming
rst76
0
370
Other Decks in Programming
See All in Programming
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
190
Fragmented Architectures
denyspoltorak
0
140
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
AgentCoreとHuman in the Loop
har1101
5
220
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
410
dchart: charts from deck markup
ajstarks
3
990
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.5k
Grafana:建立系統全知視角的捷徑
blueswen
0
320
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
Data-Centric Kaggle
isax1015
2
760
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
150
GraphQLとの向き合い方2022年版
quramy
50
14k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Building an army of robots
kneath
306
46k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
170
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
160
Mind Mapping
helmedeiros
PRO
0
74
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Transcript
̑ͰΘ͔Δ෦ܕ ΤϜεϦʔ ߴౡ྄༞ʢ@rst76ʣ
ͳͥʁ
෦ܕͱ w ܕͷ্Լʢแؚʣؔ෦ܕؔ w ԼҐͷܕΛ෦ܕͱݺͿ w +BWBͷ߹ɺܧঝͰ࣮ݱ w ܕͷมԽʹͱͳ͏෦ܕؔͷมԽ ෆมɾڞมɾม
Object Number Integer ্Ґͷܕ ԼҐͷܕ ࢠ
෦ܕؔ̍ w ্Ґͷܕ͕ظ͞Ε͍ͯΔͱ͜ΖʹɺԼҐͷܕΛ͏͜ͱͰ͖Δ Function<Object, String> objFunc = o -> o.toString()
+ "!!!"; objFunc.apply(76); // => "76!!!" objFunc.apply("ten"); // => "ten!!!"
෦ܕؔ̎ w ԼҐͷܕ͕ظ͞Ε͍ͯΔͱ͜Ζʹɺ্ҐͷܕΛ͏͜ͱͰ͖ͳ͍ Function<Integer, String> intFunc = i -> Integer.toString(i
/ 2) + "???"; intFunc.apply(76); // => "39???" intFunc.apply(new Object()); // => Compile Error
ؔͷ߹̍ w ؔܕ Function<Function<Number, String>, String> numFuncFunc = f ->
f.apply(76.0); Function<Number, String> numFunc = n -> Integer.toString(n.intValue() / 4) + "..."; numFuncFunc.apply(numFunc); // => "19..."
ؔͷ߹̎ w ҾͰؔ͢ͷҾɺԼҐͷܕʹͰ͖ͳ͍ʂ ؔ͢ɺҾͷܕʹ࿙Εͳ͘ରԠͰ͖Δʢఆ֎Ͱͳ͍ʣඞཁ͕͋Δ Function<Function<Number, String>, String> numFuncFunc = f
-> f.apply(76.0); Function<Integer, String> intFunc = i -> Integer.toString(i * 2) + "???"; numFuncFunc.apply(intFunc); // => CompileError
ؔͷ߹̏ w ٯʹ্ҐͷܕΛҾʹͱΔؔͳΒɾɾɾ Function<Function<? super Number, String>, String> numFuncFunc =
f -> f.apply(76.0); Function<Object, String> objFunc = o -> o.toString() + "!!!"; numFuncFunc.apply(objFunc); // => "76.0!!!"
·ͱΊ w ܕͷ্ԼؔɺؔͷҾͰٯస͢Δˠม w ܕָ͍͠ʂ w ָ͍ؔ͠ʂʂ
એ w ʰϫϯεɾΞϙϯɾΞϯɾΞϧΰϦζϜʱ ɹͱ͍͏ຊΛ༁͠·ͨ͠ w ༗໊ͳөըΛࡐʹɺܭࢉػՊֶΛղઆ͍ͯ͠·͢