Functional Programming In Java Alonzo Church Lambda calculus - - PowerPoint PPT Presentation

functional programming
SMART_READER_LITE
LIVE PREVIEW

Functional Programming In Java Alonzo Church Lambda calculus - - PowerPoint PPT Presentation

Functional Programming In Java Alonzo Church Lambda calculus (1930) ( x.x ) x -> x * x int powerOf2 (int x){ return x*x; } Predicate Is a function that returns true or false . x -> x == 2 Haskell Curry Combinatory logic


slide-1
SLIDE 1

Functional Programming

In Java

slide-2
SLIDE 2

Alonzo Church

Lambda calculus (1930)

slide-3
SLIDE 3


 (λx.x²)

x -> x * x int powerOf2 (int x){ return x*x; }

slide-4
SLIDE 4

Predicate

Is a function that returns true or false. x -> x == 2

slide-5
SLIDE 5

Haskell Curry

Combinatory logic

slide-6
SLIDE 6

What is FP?

Pure Functions Higher order Functions Lazy Evaluation Closure Currying

slide-7
SLIDE 7

f(x) == f(x)

A pure function has no side effects.

slide-8
SLIDE 8

What is FP?

Pure Functions Higher order Functions Lazy Evaluation Closure Currying

slide-9
SLIDE 9

Functions can be treated like data

slide-10
SLIDE 10

Functions can be treated like data

slide-11
SLIDE 11

What is FP?

Pure Functions Higher order Functions Lazy Evaluation Closure Currying

slide-12
SLIDE 12

Delays the evaluation until the value is needed

slide-13
SLIDE 13

What is FP?

Pure Functions Higher order Functions Lazy Evaluation Closure Currying

slide-14
SLIDE 14

Close but no cigar

A Closure is a function with a reference to the state of the function returning it.

slide-15
SLIDE 15

What is FP?

Pure Functions Higher order Functions Lazy Evaluation Closure Currying

slide-16
SLIDE 16

Chain the parameters!
 Chain them all!

slide-17
SLIDE 17

What is FP not?

A replacement for OOP The solution to all your problems Free performance gain

slide-18
SLIDE 18

The advantages of FP

No side effects Stateless Concurrency and (true) parallelisation Lesser rituals, therefore easier to read and maintain Code is easier to reuse

slide-19
SLIDE 19

The Future

Multithread Multicore Multi CPU Cluster APU GPU (Crossfire / SLI) FPGA (field-programmable gate array)

slide-20
SLIDE 20