The Rise of Functional Programming

869 views

Published on

Lambda to-da-bone. No not really. Just a short introduction to those we didnt know about functional programming. Especially to java programmers.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
869
On SlideShare
0
From Embeds
0
Number of Embeds
32
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

The Rise of Functional Programming

  1. 1. The rise of FunctionalProgramming A short presentation by Tjerk Wolterink
  2. 2. OutlineHands on1. From Imperative to Functional2. Java and LambdaTheory3. Referential Transparency4. Higher Order Functions5. Lazy Evaluation6. Pattern Matching
  3. 3. From Imperative toFunctional Lets dive into code straight away!
  4. 4. Initial Example (dataset)
  5. 5. The Requirement● For all persons that are older than 20, get the sum of those ages
  6. 6. Imperative Solution (Java)
  7. 7. Imperative Programming● Thinks in terms of steps todo● Time goes forward● Mutable state● Threads are needed to utilize multiple cores● Concurrent Programming and Locking
  8. 8. Functional Solution
  9. 9. Lets make it simpler
  10. 10. Definition of Sum
  11. 11. Reduction● Based on rewriting● No state
  12. 12. Functional Programming● Write what you want, not how to do it● Everything is a function● Stateless ○ No side effects, reasoning is easier● Concurrency ○ Plays extremely nice with the rising multi-core technology ○ Execute your program in a distributed network ○ Hadoop / Map Reduce● Academia love it ○ Based on λ-Calculus and Rule Rewriting ○ Easier to prove programs correct ○ No state explosion
  13. 13. Functional LanguagesFully Functional● Haskell, Lisp (from 1950!), Erlang● XSLT, Clojure (VM Based)Powerfull Functional Support● Python, JavaScript, Scala (VM Based), Groovy (VM Based)Sort of Functional● C++ function pointers● C#● Java Lambda● Bash shell? ( ls | grep test | more)
  14. 14. Java and LambaFinally Oracle got..... Hopefully
  15. 15. Java Lambda JSR-335"Extend the Java language to support compactlambda expressions (closures), as well asrelated language and library features to enablethe Java SE APIs to use lambda expressionseffectively."
  16. 16. Lambdas and Interfaces
  17. 17. Java 8 Hooray!
  18. 18. Theory If Time Allows- nope time didnt allow- Questions?

×