core fp concepts

13
Conceitos Funcionais

Upload: diego-pacheco

Post on 20-Jan-2015

218 views

Category:

Technology


4 download

DESCRIPTION

FP Core Concepts

TRANSCRIPT

Page 1: Core FP Concepts

Conceitos Funcionais

Page 2: Core FP Concepts

Functions as 1st Class Citizen

• Syntax Sugar• Abstractions• Simplicity• Utilities• Less Code More things Done• Awesome for Algorithms/calculations

Page 3: Core FP Concepts

CORE Functional Programing Fundamental Principles

1. Lambda Calculus

2. High Order Functions

3. Immutability

4. No Side Effects

Page 4: Core FP Concepts

Lambda/Closure/Anonymous Function

• Less Structure• Syntax Sugar• One time Usage• Work with High Order Functions

Page 5: Core FP Concepts

Lambda/Closure/Anonymous Function

Page 6: Core FP Concepts

High Order Functions

• Pass Function by Parameter• Return Function

• Ground for:• Lazyness• Composition

Page 7: Core FP Concepts

High Order Functions

First-class-Function Lazyness

Page 8: Core FP Concepts

High Order Functions

Composition

<= First-class-Function (oo)

<= High-Order-Function (FP)

Page 9: Core FP Concepts

Currying

• Lambda Calculus, Parallelism• Optional in several languages not Haskell• Awesome for DSL Creation• Transform: Chained Functions into single Arg

Page 10: Core FP Concepts

Currying

Page 11: Core FP Concepts

Monads

• FP way to deal with side effects• Similar to AOP Interceptors• Build Abstractions around your functions• It can encapsulate:• Control Flow (Option)• State Propagation (Io)

Page 12: Core FP Concepts

Monads

Page 13: Core FP Concepts

Conceitos Funcionais

Obrigado !!!