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
Having fun with Kotlin fun()
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Adnan A M
September 21, 2018
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Having fun with Kotlin fun()
Slides from my talk at droidcon Vienna 2018.
Adnan A M
September 21, 2018
More Decks by Adnan A M
See All by Adnan A M
Abridge Coding Guidelines
adnan321
0
73
A developer's guide to wealth
adnan321
0
290
What the Hook ?
adnan321
0
100
Scoping Your Storage
adnan321
2
190
What The Context ?
adnan321
2
240
Putting Work Manager To Work
adnan321
0
110
OOP To FP
adnan321
1
220
Putting Work Manager To Work
adnan321
1
190
A slice of Android Slices - droidcon London 2018
adnan321
0
130
Other Decks in Programming
See All in Programming
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
150
Contextとはなにか
chiroruxx
1
370
1B+ /day規模のログを管理する技術
broadleaf
0
110
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
960
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
13
6.3k
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.4k
AIで効率化できた業務・日常
ochtum
0
150
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
1
440
A2UI という光を覗いてみる
satohjohn
1
160
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.5k
Oxlintのカスタムルールの現況
syumai
6
1.2k
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Building Applications with DynamoDB
mza
96
7.1k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
For a Future-Friendly Web
brad_frost
183
10k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
350
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
66
55k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
エンジニアに許された特別な時間の終わり
watany
107
250k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
400
The Cult of Friendly URLs
andyhume
79
6.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Transcript
Having fun with Kotlin fun()
What is a function ?
“ Quote a long definition from Wikipedia here….. OR fun
myFunction() { // pretty awesome function right here }
Kotlin, give us a function !
Kotlin, give us a function !
Local Functions Functions within functions
None
Can’t unit test inner function Caveats/Gotchas Kotlin function doesn’t see
local declarations in advance
Single Expression Functions
None
Top Level Functions Extend functionality
Extension Functions Extend functionality
Extension function
Resolved Statically Under the hood Receiver Object The static function
is passed in the receiver object as a parameter
Companion objects/Static classes Caveats/Gotchas Member Functions Win
Named Arguments Thou shall name parameters
None
None
None
None
Default Parameters
None
Java interop isn’t great, must specify all parameters when calling
Caveats/Gotchas
Lambda Expressions
None
Anonymous functions
None
Higher Order Functions
None
None
None
None
None
None
None
inline functions
None
None
Let’s inline all Higher Order Functions ! Caveats/Gotchas No access
to private variables/members
None
Non local returns
None
None
None
None
None
Standard Functions
“ let, also, apply, run & with
None
None
“ Scoping functions
let
Usage of let
None
apply
Usage of apply
None
also
Usage of also
None
run
Usage of run
None
“ Transformation vs Mutating functions
“ also, apply - Mutating Functions
“ run, let - Transformation Functions
Danke Any questions? You can find me at: ◇ @AdnanM0123
Slide Theme ◇ Presentation template by SlidesCarnival ◇ Photographs by
Unsplash