0
Functional Programmingwith ScalaIntroduction by @JacekLaskowski
Jacek Laskowski@JacekLaskowskihttp://blog.japila.pl
HTTPS://GITHUB.COM/PCHIUSANO/FPINSCALA
HTTP://WWW.ATOMICSCALA.COM/
HTTPS://WWW.COURSERA.ORG/COURSE/PROGFUN
Functional programmingIn computer science, functional programmingis a programming paradigm that treatscomputation as the e...
Functional programming•Programming paradigm•Computation = function evaluation•Avoids state and mutable data•Function compo...
Scala is a modern multi-paradigmprogramming language designed to expresscommon programming patterns in a concise, elegant,...
Keyword todefine a MethodMethod’s nameMethod’s inputparameters andtheir typesMethod’sreturn type(optional)Method’s body
Expression vs statement•A statement changes state•it’s called for side effects•An expression produces resultFROM “ATOMIC S...
Everything in Scala is anexpression
Is this an expression?YES!Is this an expression?YES!
Type => TypeFunction type
Function type examples•Int => String•(Int, Int) => Int•Int => Int => Int•(Int => Int) => Int
Scala REPL
Collections in Scala•Vector•Set•Map•Range
Functional trio•map•filter•reduce (foldLeft + foldRight)
Function literal
Function composition
Jacek Laskowski@JacekLaskowskihttp://blog.japila.plPitannja?
Upcoming SlideShare
Loading in...5
×

Introduction to Functional Programming in Scala

629

Published on

Presentation from my talk at JEEConf (http://jeeconf.com) in Kiev, Ukraine on 24th of May, 2013

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
629
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
21
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction to Functional Programming in Scala"

  1. 1. Functional Programmingwith ScalaIntroduction by @JacekLaskowski
  2. 2. Jacek Laskowski@JacekLaskowskihttp://blog.japila.pl
  3. 3. HTTPS://GITHUB.COM/PCHIUSANO/FPINSCALA
  4. 4. HTTP://WWW.ATOMICSCALA.COM/
  5. 5. HTTPS://WWW.COURSERA.ORG/COURSE/PROGFUN
  6. 6. Functional programmingIn computer science, functional programmingis a programming paradigm that treatscomputation as the evaluation ofmathematical functions and avoids state andmutable data. It emphasizes the application offunctions, in contrast to the imperative programmingstyle, which emphasizes changes in state.HTTP://EN.WIKIPEDIA.ORG/WIKI/FUNCTIONAL_PROGRAMMING
  7. 7. Functional programming•Programming paradigm•Computation = function evaluation•Avoids state and mutable data•Function composition•Expressions everywhere
  8. 8. Scala is a modern multi-paradigmprogramming language designed to expresscommon programming patterns in a concise, elegant,and type-safe way. It smoothly integrates featuresof object-oriented and functional languages.HTTP://WWW.SCALA-LANG.ORG/NODE/104Scala is also a functional languagein the sense that every function is avalue.
  9. 9. Keyword todefine a MethodMethod’s nameMethod’s inputparameters andtheir typesMethod’sreturn type(optional)Method’s body
  10. 10. Expression vs statement•A statement changes state•it’s called for side effects•An expression produces resultFROM “ATOMIC SCALA” BY BRUCE ECKEL AND DIANNE MARSH
  11. 11. Everything in Scala is anexpression
  12. 12. Is this an expression?YES!Is this an expression?YES!
  13. 13. Type => TypeFunction type
  14. 14. Function type examples•Int => String•(Int, Int) => Int•Int => Int => Int•(Int => Int) => Int
  15. 15. Scala REPL
  16. 16. Collections in Scala•Vector•Set•Map•Range
  17. 17. Functional trio•map•filter•reduce (foldLeft + foldRight)
  18. 18. Function literal
  19. 19. Function composition
  20. 20. Jacek Laskowski@JacekLaskowskihttp://blog.japila.plPitannja?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×