Ash Furrow, Functional programming in swift
-
Upload
elena-voynova -
Category
Mobile
-
view
197 -
download
2
description
Transcript of Ash Furrow, Functional programming in swift
![Page 1: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/1.jpg)
the f&t&re of
Ash Furrow, Artsy
functional programming
on iOS
![Page 2: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/2.jpg)
![Page 3: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/3.jpg)
Objective-C
![Page 4: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/4.jpg)
Closures
Functional patterns
Concise syntax
Native Collections
Operator overloading
Namespaces Tuples
Clear mutability syntax
Interactive playground Multiple return types
Generics
Protocols and extensions on structsPattern matching
Fast iteration
Optional types
Object orientation
Type inference
Read-Eval-Print-Loop (REPL)
Compile to native code
![Page 5: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/5.jpg)
Closures
Functional patterns
Concise syntax
Native Collections
Operator overloading
Namespaces Tuples
Clear mutability syntax
Interactive playground Multiple return types
Generics
Protocols and extensions on structsPattern matching
Fast iteration
Optional types
Object orientation
Type inference
Read-Eval-Print-Loop (REPL)
Compile to native code
![Page 6: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/6.jpg)
Closures
Functional patterns
Concise syntax
Native Collections
Operator overloading
Namespaces Tuples
Clear mutability syntax
Interactive playground Multiple return types
Generics
Protocols and extensions on structsPattern matching
Fast iteration
Optional types
Object orientation
Type inference
Read-Eval-Print-Loop (REPL)
Compile to native code
![Page 7: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/7.jpg)
Objective-C
![Page 8: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/8.jpg)
![Page 9: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/9.jpg)
It will not be we make apps for the WATCH 5 and the other future iOS devices. It will be a group of developers very much like us. But with more of our strengths and fewer of our weaknesses. More confident, far-seeing, and capable of using functional paradigms. For all of our failings, despite our limitations and fallibilities, we developers are capable of greatness.
—Carl Sagan
![Page 10: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/10.jpg)
1. Imperative prog5amming is old and busted
2. Functional prog5amming is the new ho?@ess
3. Ge?ing starCed with f&nctional prog5amming in Swist is super-‐easy
![Page 11: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/11.jpg)
old
and
busted
![Page 12: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/12.jpg)
ANDA MASK ;AND A with Mask BNE ADD1 BRA NONE1 ADD1 INY ;increment our counter of 1's NONE1 LDAA TEMP ;reload accumulator A LSL MASK ;Shift the mask's 1 bit left BNE LOOP1 ;If we haven't finished our loop, branch LDAA #$01 ;load new mask into A STAA MASK ;store the reset mask into MASK TSX ;pull of return address and store in X PULA ;pull off A STAA TEMP ;store the value into temp TXS ;push return address back onto the stack LOOP2 LDAA TEMP ;Load A into TEMP ANDA MASK ;logical AND MASK with A BNE ADD2 ;add one if we need to BRA NONE2 ADD2 INY ;increment our counter of 1's NONE2 LDAA TEMP LSL MASK ;shift our mask left by one BNE LOOP2 ;loop back until we've exhausted positions STY TEMP ;store Y into TEMP - this is the number of 1's
![Page 13: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/13.jpg)
newhottness
![Page 14: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/14.jpg)
functional programming
• It’s been around forever
• But only in universities (ew)
![Page 15: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/15.jpg)
what is functional programming?
• Treat computation as the result of functions
• Avoid mutable state and data
![Page 16: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/16.jpg)
f&nctional prog5amming tells the computer
instead of
what to do
how to do it
![Page 17: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/17.jpg)
getting started
is
super-easy
![Page 18: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/18.jpg)
code
let’s
![Page 19: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/19.jpg)
github.com/ashfurrow/minsk
![Page 20: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/20.jpg)
resources
• Books
• Blogs
• GitHub
• ReactiveCocoa
• LlamaKit
• Stack Overflow
• Tweet me
![Page 21: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/21.jpg)
objc.io/books
![Page 22: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/22.jpg)
github.com/artsy/eidolon
![Page 23: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/23.jpg)
1. Imperative prog5amming is old and busted
2. Functional prog5amming is the new ho?@ess
3. Ge?ing starCed with f&nctional prog5amming in Swist is super-‐easy
![Page 24: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/24.jpg)
so where now?
• Swift promised functional patterns
• Failed to deliver
• Community is picking up the slack
![Page 25: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/25.jpg)
make
better mistakes
tomorrow
![Page 26: Ash Furrow, Functional programming in swift](https://reader034.fdocuments.in/reader034/viewer/2022042614/559b733d1a28ab07398b467e/html5/thumbnails/26.jpg)
thanks
@ashfurrow