Introduction to Functional Programming in Scala
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Introduction to Functional Programming in Scala

  • 1,015 views
Uploaded on

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

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,015
On Slideshare
855
From Embeds
160
Number of Embeds
2

Actions

Shares
Downloads
13
Comments
0
Likes
2

Embeds 160

http://jeeconf.com 159
http://blog.japila.pl 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Functional Programmingwith ScalaIntroduction by @JacekLaskowski
  • 2. Jacek Laskowski@JacekLaskowskihttp://blog.japila.pl
  • 3. HTTPS://GITHUB.COM/PCHIUSANO/FPINSCALA
  • 4. HTTP://WWW.ATOMICSCALA.COM/
  • 5. HTTPS://WWW.COURSERA.ORG/COURSE/PROGFUN
  • 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. Functional programming•Programming paradigm•Computation = function evaluation•Avoids state and mutable data•Function composition•Expressions everywhere
  • 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. Keyword todefine a MethodMethod’s nameMethod’s inputparameters andtheir typesMethod’sreturn type(optional)Method’s body
  • 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. Everything in Scala is anexpression
  • 12. Is this an expression?YES!Is this an expression?YES!
  • 13. Type => TypeFunction type
  • 14. Function type examples•Int => String•(Int, Int) => Int•Int => Int => Int•(Int => Int) => Int
  • 15. Scala REPL
  • 16. Collections in Scala•Vector•Set•Map•Range
  • 17. Functional trio•map•filter•reduce (foldLeft + foldRight)
  • 18. Function literal
  • 19. Function composition
  • 20. Jacek Laskowski@JacekLaskowskihttp://blog.japila.plPitannja?