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
Adnan A M
September 21, 2018
Programming
0
96
Having fun with Kotlin fun()
Slides from my talk at droidcon Vienna 2018.
Adnan A M
September 21, 2018
Tweet
Share
More Decks by Adnan A M
See All by Adnan A M
Abridge Coding Guidelines
adnan321
0
52
A developer's guide to wealth
adnan321
0
260
What the Hook ?
adnan321
0
88
Scoping Your Storage
adnan321
2
160
What The Context ?
adnan321
2
220
Putting Work Manager To Work
adnan321
0
100
OOP To FP
adnan321
1
200
Putting Work Manager To Work
adnan321
1
160
A slice of Android Slices - droidcon London 2018
adnan321
0
110
Other Decks in Programming
See All in Programming
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
240
Flutterで分数(Fraction)を表示する方法
koukimiura
0
140
オープンソースソフトウェアへの解像度🔬
utam0k
17
3.1k
O Que É e Como Funciona o PHP-FPM?
marcelgsantos
0
190
kiroとCodexで最高のSpec駆動開発を!!数時間で web3ネイティブなミニゲームを作ってみたよ!
mashharuki
0
870
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
360
NIKKEI Tech Talk#38
cipepser
0
140
Leading Effective Engineering Teams in the AI Era
addyosmani
7
580
Reactive Thinking with Signals and the Resource API
manfredsteyer
PRO
0
110
Devvox Belgium - Agentic AI Patterns
kdubois
1
140
Claude Agent SDK を使ってみよう
hyshu
0
1.4k
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
180
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Why Our Code Smells
bkeepers
PRO
340
57k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Music & Morning Musume
bryan
46
6.9k
Become a Pro
speakerdeck
PRO
29
5.6k
Code Reviewing Like a Champion
maltzj
526
40k
The Cost Of JavaScript in 2023
addyosmani
55
9.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
KATA
mclloyd
PRO
32
15k
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