$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlinのリストのmap関数、自動生成されているって!
Search
RyotaMurohoshi
August 25, 2018
Technology
3
630
Kotlinのリストのmap関数、自動生成されているって!
2018年8月25日(土)のKotlin FestのLT資料です!
RyotaMurohoshi
August 25, 2018
Tweet
Share
More Decks by RyotaMurohoshi
See All by RyotaMurohoshi
Tilemapのアップデートについて
ryotamurohoshi
0
55
Unityの合同同人誌や合同商業誌を書いてる僕は感想やレビューや評価が欲しい
ryotamurohoshi
0
560
Unity 2021.1での Unityパッケージの名称変更について
ryotamurohoshi
0
760
Odin Validationはいいぞ!
ryotamurohoshi
2
1k
Tilemapはいいぞ!2020 〜すごいぞ、プロジェクト専用拡張Brush〜
ryotamurohoshi
0
2.4k
Unityでも、新しいC#
ryotamurohoshi
0
1.4k
Riderはいいぞ!
ryotamurohoshi
1
3.6k
Riderのススメ〜俺はRiderここが好き〜
ryotamurohoshi
1
2.6k
Unity開発者に伝えたい.NETのこと
ryotamurohoshi
4
38k
Other Decks in Technology
See All in Technology
接客歴・営業歴の方が長いエンジニアから見たre:Invent2025
yama3133
0
100
シニアソフトウェアエンジニアになるためには
kworkdev
PRO
3
240
普段使ってるClaude Skillsの紹介(by Notebooklm)
zerebom
8
1.9k
ZOZOの独自性を生み出す「似合う4大要素」の開発サイクル
zozotech
PRO
0
120
Strands AgentsとNova 2 SonicでS2Sを実践してみた
yama3133
1
1.6k
AWSインフルエンサーへの道 / load of AWS Influencer
whisaiyo
0
200
TED_modeki_共創ラボ_20251203.pdf
iotcomjpadmin
0
120
フィッシュボウルのやり方 / How to do a fishbowl
pauli
2
350
mairuでつくるクレデンシャルレス開発環境 / Credential-less development environment using Mailru
mirakui
5
580
会社紹介資料 / Sansan Company Profile
sansan33
PRO
11
390k
MySQLとPostgreSQLのコレーション / Collation of MySQL and PostgreSQL
tmtms
1
1.1k
SQLだけでマイグレーションしたい!
makki_d
0
1.2k
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Heart Work Chapter 1 - Part 1
lfama
PRO
3
35k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
130
The Spectacular Lies of Maps
axbom
PRO
1
400
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
180
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
750
Practical Orchestrator
shlominoach
190
11k
Building Adaptive Systems
keathley
44
2.9k
The Language of Interfaces
destraynor
162
25k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
400
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
2
2.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Transcript
Kotlinのリストのmap関数のコード 自動生成されてるって! @RyotaMurohoshi 2018/08/25(土) Kotlin Fest LT
Kotlin 1.3にて 符号なし整数値型が登場予定! ※現状はまだExperimental
ソースコードを覗いてみましょう! https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/stdlib/unsigned/src/kotlin
UInt
UShort
None
ほぼ一緒じゃん! ※ ここチョイ笑いするとこですよ
ところでちょっと気になるコメントに 気が付きましたか?
UInt
拡大すると・・・
ここ!!!
符号なし整数値型のコード 自動生成されてる! ※ ここ「へー」っていうことですよ!
`kotlin/generators`ディレクトリの `builtins/generateBuiltIns.kt`をみてね! https://github.com/JetBrains/kotlin/blob/v1.3-M1/generators/builtins/arrayIterators.kt `ranges`や`iterator`も生成されているよ!
ところで、Kotlinのstdlib・・・
https://github.com/JetBrains/kotlin/tree/1.2.60/libraries/stdlib Standard LibraryのReadMeには・・・
https://github.com/JetBrains/kotlin/tree/1.2.60/libraries/stdlib Standard LibraryのReadMeには・・・
そう、stdlibにも自動生成されたコードが! ※ ここ「へー」っていうことですよ!
どんなコードが自動生成されている? みんながよく使うアレも自動生成されている!
これ!map拡張関数! みんなが大好きリストのmap関数!
map拡張関数の実装も・・・? https://github.com/JetBrains/kotlin/blob/1.2.60/libraries/stdlib/common/src/generated/_Collections.kt#L1217
こいつも自動生成!!! ※ ここみんなが大きな声で「へー」っていうことですよ!
そう、mapもfilterも 実は、自動生成されているんです! ※ ここ”も”みんなが大きな声で「へー」っていうことですよ!
kotlin/libraries/tools/kotlin-stdlib-gen https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/tools/kotlin-stdlib-gen
kotlin/libraries/tools/kotlin-stdlib-gen https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/tools/kotlin-stdlib-gen Kotlinでのコード生成に興味があったら、読んでみて! @DslMarkerも利用した、コードジェネレータDSL! KDocも、DSLでいい感じに作っている!
kotlin/libraries/tools/kotlin-stdlib-gen https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/tools/kotlin-stdlib-gen • `src/generators/GenerateStandardLib.kt`がエントリポイント • `src/templates/dsl`以下に、DSLのためのクラス群がある • `src/templates`以下に、DSLを利用したメソッドを実際に生成するクラス群
まとめ • Kotlinのコード、自動生成されているよ! • `kotlin/generators/builtins` • `kotlin/libraries/tools/kotlin-stdlib-gen` • stdlibのコード、DSLやコードジェネレーターの参考になるよ! •
ドメインがKotlinだから、他の知識なしでも理解が!
詳しくはブログで!
2018/08/25(土) Kotlin Fest LT @RyotaMurohoshi リストのmap関数のコード 自動生成されてるって!
時間が余ったのでみなさん大きな声で 「へーーー!」 って言っください! リストのmap関数のコード 自動生成されてるって!
Kotlinかわいい!