SlideShare a Scribd company logo
Globalcode	–	Open4education
Trilha – Programação Funcional
Roberto Pepato Mellado
Engenheiro de Software
Globalcode	–	Open4education
Haskell 101
“Haskell is a computer programming language. In particular, it is
a p o l y m o r p h i c a l l y s t a t i c a l l y t y p e d , l a z y, p u r e l y
functional language, quite different from most other programming
languages.”
https://wiki.haskell.org/Introduction
Function Application Immutability Currying
Category Theory Monads
Function Composition
…
Globalcode	–	Open4education
Understandability

Formalism
Data? Code?
int x = 2;
private int incr (int seed)
{
return seed + 1;
}
Code + Data
Prelude> x = 2
Prelude> incr x = x + 1
Code is Data
Functions as first class citizens
Static Typing
Prelude> x = 2
-- :type or :t 

Prelude> :t x

x :: Num t => t
Prelude> incr x = x + 1
Prelude> :t incr

incr :: Num a => a -> a
Basic Types
Type
A collection of related values
Bool
Logical values: True, False.
Char
Single Characters
String
Strings of characters
Int
Fixed-point precision integers
Integer
Arbitrary precision integers
Float
Single-precision floating points
List
Sequence of elements of the same
type
Tuple
A finite sequence of components of
possibly different types
e.g. (Bool -> Bool)
All Bool to Bool function mappings
Function Application
In mathematics…
f (a, b) + c d
Prelude> adder a = a + 1
Prelude> tripler c = c * 3
Prelude> adder 2
3
Prelude> adder (tripler 4)
13
f a b + c * d
((f a) b) + c * d
Currying
Prelude> sum a b = a + b
Prelude> :t sum

sum :: Num a => a -> a -> a
Prelude> square x = x * x
Prelude> :t square

square :: Num a => a -> a
In haskell, functions are curried
Currying
Prelude> :t map
map :: (a -> b) -> [a] -> [b]
Prelude> map (+ 1) [1,2,3,4,5]
[2,3,4,5,6]
Prelude> squares = map square
:t squares
squares :: Num b => [b] -> [b]
squares [1,2,3,4,5]
[1,4,9,16,25]
High Order Functions
Prelude> twice f x = f (f x)
Prelude> twice (*2) 3

12
Prelude> twice reverse [1,2,3]
[1,2,3]
Sum of the squares of all even numbers from 1 to 100?
sum: adds items from a list

square: already defined

filter: filter list elements

even: true if a number is even, false otherwise
Prelude> sumsqreven ns = sum(map (square)
(filter even ns))
Prelude> sumsqreven [1..100]
171700
Function Composition
Prelude> double x = x + x
Prelude> triple x = double x + x
Prelude> sixTimes = double . triple
Prelude> sixTimes 5
30
Function Composition
Prelude> fsum = sum . map (square) . filter even
Prelude> [1..100]
[1,2,3,4,5,6,7,…]
Prelude> fsum [1..100]
171700
Prelude> verifyStatus = …
Prelude> checkCredit = …
Prelude> validate = …
Prelude> generateOrder = …
Prelude> sendEmail = …
Prelude> applyTransaction = sendEmail . generateOrder
. validate . checkCredit . verifyStatus
Pattern Matching
Prelude> head [1..10]
1
Prelude> tail [1..10]
[2,3,4,5,6,7,8,9,10]
Prelude> length [] = 0
Prelude> length (_:xs) = 1 + length xs
Prelude> length []
0
Prelude> length [2,2,2,2,2,2,2]
7
Prelude> cabeca (x:xs) = x
1
Prelude> cauda(x:xs) = xs
[2,3,4,5,6,7,8,9,10]
Prelude> cabeca (x:_) = x
Prelude> cauda(_:xs) = xs
Pattern Matching
Prelude> check (403, ip, timestamp) = ip
Prelude> check (_, _, _) = “ok”
Prelude> analyzelog xs = [check x | x <- xs]
Prelude> analyzelog [

(200, “200.251.192.13”, 1467313969905), 

(403, “200.168.175.28”, 1467314005735), 

(500, “201.52.164.78, 1467314029977)
]
“ok”
“200.168.175.28”
“ok”
Lazy
Prelude> mult (x, y) = x * y
Call by value
> mult (1+2, 3+4)
{ applying + }
mult (3, 3 + 4)
{ applying + }
mult (3, 7)
{ applying mult }
3 * 7
{ applying * }
21
Call by name
> mult (1+2, 3+4)
{ applying mult }
(1+2) * (3+4)
{ applying + }
3 * (3 + 4)
{ applying + }
3 * 7
{ applying * }
21
Haskell strategy is based
on call-by-name
Lazy
Prelude> list = 1 : 2 : []
[1,2]
Call by value
> head ones
{ applying ones }
head (1 : ones)

{ applying ones }
head (1 : (1 : ones))

{ applying ones }
.
.
.
> ones = 1 : ones
> ones
{ applying ones }
1 : ones
{ applying ones }
1 : (1 : ones )
{ applying ones }
1 : (1 : (1 : ones))
[1, 1, 1, 1, 1, 1, 1, 1, 1…]
Lazy
Prelude> list = 1 : 2 : []
> ones = 1 : ones
> ones
{ applying ones }
1 : ones
{ applying ones }
1 : (1 : ones )
{ applying ones }
1 : (1 : (1 : ones))
[1, 1, 1, 1, 1, 1, 1, 1, 1…]
Call by name
> head ones
{ applying ones }
head (1 : ones)

{ applying head }
1
Immutability
> combine a b = a ++ b
> combine [1,2,3] [4]
[1,2,3,4]
> let x = [1,2,3]
> combine x [4]
[1,2,3,4]

> x
[1,2,3]

> drop 1 x
[2,3]

> x
[1,2,3]
Referential Transparency
> incr a = a + 1
> incr 6
7
Breaking Ref Transparency
class OrderCalculator {
Order _order;
public Calculator (Order order){

_order = order;
}
public void applyDiscount() {

_order.total *= 0.90;
}
public void applyDeliveryTax() {
_order.total += 10;
}
public double getTotal() {
return _order.total;
}
}
// set order total
Order o = new Order(100);
OrderCalculator oc = new
OrderCalculator(o);
oc.applyDeliveryTax();
oc.applyDiscount();
oc.getTotal(); //99
o = new Order(100);
oc = new
OrderCalculator(o);
oc.applyDiscount();
oc.applyDeliveryTax();
oc.getTotal(); //100
Pure
1. The function always evaluates the same result value given the same
argument value(s). The function result value cannot depend on any hidden
information or state that may change while program execution proceeds or
between different executions of the program, nor can it depend on any external
input from I/O devices.

2. Evaluation of the result does not cause any semantically observable side
effect or output, such as mutation of mutable objects or output to I/O devices.
read
data
write
data
raise
exception
change
state
…
Monads
A monad is a way to structure computations in terms of values and
sequences of computations using those values.

It is a parameterized type m that supports return and bind functions of the
specified types.
class Monad m where

return :: a -> ma

(>>=) :: ma -> (a -> mb) -> mb
It allows computation to be isolated from side-effects and non-
determinism.
More?
Enjoy this track :)
Programming in Haskell - Graham Hutton
Real World Haskell - http://book.realworldhaskell.org/read/
Learn You a Haskell for Great Good - http://learnyouahaskell.com
A Gentle Introduction to Haskell - https://www.haskell.org/tutorial/

Introduction to Functional Programming - Erik Meijer - edX
Don’t Fear the Monad (search on youtube) - Brian Beckman
Globalcode	–	Open4education
Thanks!
http://www.slideshare.net/rpepato
@rpepato

More Related Content

What's hot

Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskell
faradjpour
 
18. Java associative arrays
18. Java associative arrays18. Java associative arrays
18. Java associative arrays
Intro C# Book
 
Python Cheat Sheet
Python Cheat SheetPython Cheat Sheet
Python Cheat Sheet
Muthu Vinayagam
 
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)stasimus
 
Collection Core Concept
Collection Core ConceptCollection Core Concept
Collection Core Concept
Rays Technologies
 
Python : Dictionaries
Python : DictionariesPython : Dictionaries
Java arrays
Java   arraysJava   arrays
Java arrays
Maneesha Caldera
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)riue
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
ikdysfm
 
Python programming -Tuple and Set Data type
Python programming -Tuple and Set Data typePython programming -Tuple and Set Data type
Python programming -Tuple and Set Data type
Megha V
 
Map, Reduce and Filter in Swift
Map, Reduce and Filter in SwiftMap, Reduce and Filter in Swift
Map, Reduce and Filter in Swift
Aleksandras Smirnovas
 
The java language cheat sheet
The java language cheat sheetThe java language cheat sheet
The java language cheat sheet
anand_study
 
19. Java data structures algorithms and complexity
19. Java data structures algorithms and complexity19. Java data structures algorithms and complexity
19. Java data structures algorithms and complexity
Intro C# Book
 
Mementopython3 english
Mementopython3 englishMementopython3 english
Mementopython3 english
ssuser442080
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
Aleksandar Veselinovic
 
Postgresql 9.3 overview
Postgresql 9.3 overviewPostgresql 9.3 overview
Postgresql 9.3 overview
Aveic
 
07. Arrays
07. Arrays07. Arrays
07. Arrays
Intro C# Book
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
Svet Ivantchev
 
Java cheatsheet
Java cheatsheetJava cheatsheet
Java cheatsheet
Anass SABANI
 

What's hot (20)

Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskell
 
18. Java associative arrays
18. Java associative arrays18. Java associative arrays
18. Java associative arrays
 
Python Cheat Sheet
Python Cheat SheetPython Cheat Sheet
Python Cheat Sheet
 
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)
 
Collection Core Concept
Collection Core ConceptCollection Core Concept
Collection Core Concept
 
Python : Dictionaries
Python : DictionariesPython : Dictionaries
Python : Dictionaries
 
Java arrays
Java   arraysJava   arrays
Java arrays
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
Python programming -Tuple and Set Data type
Python programming -Tuple and Set Data typePython programming -Tuple and Set Data type
Python programming -Tuple and Set Data type
 
Map, Reduce and Filter in Swift
Map, Reduce and Filter in SwiftMap, Reduce and Filter in Swift
Map, Reduce and Filter in Swift
 
The java language cheat sheet
The java language cheat sheetThe java language cheat sheet
The java language cheat sheet
 
19. Java data structures algorithms and complexity
19. Java data structures algorithms and complexity19. Java data structures algorithms and complexity
19. Java data structures algorithms and complexity
 
Mementopython3 english
Mementopython3 englishMementopython3 english
Mementopython3 english
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
 
Array
ArrayArray
Array
 
Postgresql 9.3 overview
Postgresql 9.3 overviewPostgresql 9.3 overview
Postgresql 9.3 overview
 
07. Arrays
07. Arrays07. Arrays
07. Arrays
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
 
Java cheatsheet
Java cheatsheetJava cheatsheet
Java cheatsheet
 

Viewers also liked

TDC2016SP - Trilha BigData
TDC2016SP - Trilha BigDataTDC2016SP - Trilha BigData
TDC2016SP - Trilha BigData
tdc-globalcode
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
tdc-globalcode
 
Jain Traders, Jodhpur, Camping Tent
Jain Traders, Jodhpur, Camping TentJain Traders, Jodhpur, Camping Tent
Jain Traders, Jodhpur, Camping Tent
IndiaMART InterMESH Limited
 
Cujareño, la historia de un grupo etnico
Cujareño, la historia de un grupo etnicoCujareño, la historia de un grupo etnico
Cujareño, la historia de un grupo etnico
Raul Alexander Rosadio Sifuentes
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
tdc-globalcode
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
tdc-globalcode
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
tdc-globalcode
 
Criando Desktop Apps com Electron
Criando Desktop Apps com ElectronCriando Desktop Apps com Electron
Criando Desktop Apps com Electron
Emerson Thompson
 
TDC2016SP - Trilha BigData
TDC2016SP - Trilha BigDataTDC2016SP - Trilha BigData
TDC2016SP - Trilha BigData
tdc-globalcode
 
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecerTDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
Stefan Teixeira
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
tdc-globalcode
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
tdc-globalcode
 
TDC SP 2016: Ionic 2
TDC SP 2016: Ionic 2TDC SP 2016: Ionic 2
TDC SP 2016: Ionic 2
Loiane Groner
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
tdc-globalcode
 
TDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e FacilitaçõesTDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e Facilitações
tdc-globalcode
 
TDC2016SP - Trilha Impressão 3D
TDC2016SP - Trilha Impressão 3DTDC2016SP - Trilha Impressão 3D
TDC2016SP - Trilha Impressão 3D
tdc-globalcode
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
tdc-globalcode
 

Viewers also liked (19)

TDC2016SP - Trilha BigData
TDC2016SP - Trilha BigDataTDC2016SP - Trilha BigData
TDC2016SP - Trilha BigData
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
 
Jain Traders, Jodhpur, Camping Tent
Jain Traders, Jodhpur, Camping TentJain Traders, Jodhpur, Camping Tent
Jain Traders, Jodhpur, Camping Tent
 
Cujareño, la historia de un grupo etnico
Cujareño, la historia de un grupo etnicoCujareño, la historia de un grupo etnico
Cujareño, la historia de un grupo etnico
 
BuddyAnderson_010915
BuddyAnderson_010915BuddyAnderson_010915
BuddyAnderson_010915
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
 
Criando Desktop Apps com Electron
Criando Desktop Apps com ElectronCriando Desktop Apps com Electron
Criando Desktop Apps com Electron
 
Les Coves
Les CovesLes Coves
Les Coves
 
TDC2016SP - Trilha BigData
TDC2016SP - Trilha BigDataTDC2016SP - Trilha BigData
TDC2016SP - Trilha BigData
 
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecerTDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
 
TDC SP 2016: Ionic 2
TDC SP 2016: Ionic 2TDC SP 2016: Ionic 2
TDC SP 2016: Ionic 2
 
TDC2016SP - Trilha Microservices
TDC2016SP - Trilha MicroservicesTDC2016SP - Trilha Microservices
TDC2016SP - Trilha Microservices
 
TDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e FacilitaçõesTDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e Facilitações
 
TDC2016SP - Trilha Impressão 3D
TDC2016SP - Trilha Impressão 3DTDC2016SP - Trilha Impressão 3D
TDC2016SP - Trilha Impressão 3D
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
 

Similar to TDC2016SP - Trilha Programação Funcional

Java VS Python
Java VS PythonJava VS Python
Java VS Python
Simone Federici
 
Javascript
JavascriptJavascript
Javascript
Vlad Ifrim
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
Calvin Cheng
 
Problem 1 Show the comparison of runtime of linear search and binar.pdf
Problem 1 Show the comparison of runtime of linear search and binar.pdfProblem 1 Show the comparison of runtime of linear search and binar.pdf
Problem 1 Show the comparison of runtime of linear search and binar.pdf
ebrahimbadushata00
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Spark workshop
Spark workshopSpark workshop
Spark workshop
Wojciech Pituła
 
Clojure basics
Clojure basicsClojure basics
Clojure basics
Knoldus Inc.
 
Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programming
VisnuDharsini
 
The Ring programming language version 1.7 book - Part 35 of 196
The Ring programming language version 1.7 book - Part 35 of 196The Ring programming language version 1.7 book - Part 35 of 196
The Ring programming language version 1.7 book - Part 35 of 196
Mahmoud Samir Fayed
 
Seminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mmeSeminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mme
Vyacheslav Arbuzov
 
Monadologie
MonadologieMonadologie
Monadologie
league
 
The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202
Mahmoud Samir Fayed
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsEelco Visser
 
Functions In Scala
Functions In Scala Functions In Scala
Functions In Scala
Knoldus Inc.
 
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181
Mahmoud Samir Fayed
 
The secrets of inverse brogramming
The secrets of inverse brogrammingThe secrets of inverse brogramming
The secrets of inverse brogramming
Richie Cotton
 
Array Cont
Array ContArray Cont
The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180
Mahmoud Samir Fayed
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdf
Rahul04August
 
Lecture#6 functions in c++
Lecture#6 functions in c++Lecture#6 functions in c++
Lecture#6 functions in c++
NUST Stuff
 

Similar to TDC2016SP - Trilha Programação Funcional (20)

Java VS Python
Java VS PythonJava VS Python
Java VS Python
 
Javascript
JavascriptJavascript
Javascript
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
 
Problem 1 Show the comparison of runtime of linear search and binar.pdf
Problem 1 Show the comparison of runtime of linear search and binar.pdfProblem 1 Show the comparison of runtime of linear search and binar.pdf
Problem 1 Show the comparison of runtime of linear search and binar.pdf
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Spark workshop
Spark workshopSpark workshop
Spark workshop
 
Clojure basics
Clojure basicsClojure basics
Clojure basics
 
Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programming
 
The Ring programming language version 1.7 book - Part 35 of 196
The Ring programming language version 1.7 book - Part 35 of 196The Ring programming language version 1.7 book - Part 35 of 196
The Ring programming language version 1.7 book - Part 35 of 196
 
Seminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mmeSeminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mme
 
Monadologie
MonadologieMonadologie
Monadologie
 
The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
 
Functions In Scala
Functions In Scala Functions In Scala
Functions In Scala
 
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181
 
The secrets of inverse brogramming
The secrets of inverse brogrammingThe secrets of inverse brogramming
The secrets of inverse brogramming
 
Array Cont
Array ContArray Cont
Array Cont
 
The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdf
 
Lecture#6 functions in c++
Lecture#6 functions in c++Lecture#6 functions in c++
Lecture#6 functions in c++
 

More from tdc-globalcode

TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadeTDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
tdc-globalcode
 
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
tdc-globalcode
 
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de SucessoTDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
tdc-globalcode
 
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPATDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
tdc-globalcode
 
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinoTDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
tdc-globalcode
 
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
tdc-globalcode
 
TDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicesTDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devices
tdc-globalcode
 
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca PublicaTrilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
tdc-globalcode
 
Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#
tdc-globalcode
 
TDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case EasylocusTDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case Easylocus
tdc-globalcode
 
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
tdc-globalcode
 
TDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em GolangTDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em Golang
tdc-globalcode
 
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QATDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
tdc-globalcode
 
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciaTDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
tdc-globalcode
 
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR ServiceTDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
tdc-globalcode
 
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETTDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
tdc-globalcode
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
tdc-globalcode
 
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
tdc-globalcode
 
TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#
tdc-globalcode
 
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net CoreTDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
tdc-globalcode
 

More from tdc-globalcode (20)

TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadeTDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
 
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
 
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de SucessoTDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
 
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPATDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
 
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinoTDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
 
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
 
TDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicesTDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devices
 
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca PublicaTrilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
 
Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#
 
TDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case EasylocusTDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case Easylocus
 
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
 
TDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em GolangTDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em Golang
 
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QATDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
 
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciaTDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
 
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR ServiceTDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
 
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETTDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
 
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
 
TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#
 
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net CoreTDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
 

Recently uploaded

"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

TDC2016SP - Trilha Programação Funcional

  • 1. Globalcode – Open4education Trilha – Programação Funcional Roberto Pepato Mellado Engenheiro de Software
  • 3. “Haskell is a computer programming language. In particular, it is a p o l y m o r p h i c a l l y s t a t i c a l l y t y p e d , l a z y, p u r e l y functional language, quite different from most other programming languages.” https://wiki.haskell.org/Introduction Function Application Immutability Currying Category Theory Monads Function Composition …
  • 6. Data? Code? int x = 2; private int incr (int seed) { return seed + 1; } Code + Data Prelude> x = 2 Prelude> incr x = x + 1 Code is Data Functions as first class citizens
  • 7. Static Typing Prelude> x = 2 -- :type or :t 
 Prelude> :t x
 x :: Num t => t Prelude> incr x = x + 1 Prelude> :t incr
 incr :: Num a => a -> a
  • 8. Basic Types Type A collection of related values Bool Logical values: True, False. Char Single Characters String Strings of characters Int Fixed-point precision integers Integer Arbitrary precision integers Float Single-precision floating points List Sequence of elements of the same type Tuple A finite sequence of components of possibly different types e.g. (Bool -> Bool) All Bool to Bool function mappings
  • 9. Function Application In mathematics… f (a, b) + c d Prelude> adder a = a + 1 Prelude> tripler c = c * 3 Prelude> adder 2 3 Prelude> adder (tripler 4) 13 f a b + c * d ((f a) b) + c * d
  • 10. Currying Prelude> sum a b = a + b Prelude> :t sum
 sum :: Num a => a -> a -> a Prelude> square x = x * x Prelude> :t square
 square :: Num a => a -> a In haskell, functions are curried
  • 11. Currying Prelude> :t map map :: (a -> b) -> [a] -> [b] Prelude> map (+ 1) [1,2,3,4,5] [2,3,4,5,6] Prelude> squares = map square :t squares squares :: Num b => [b] -> [b] squares [1,2,3,4,5] [1,4,9,16,25]
  • 12. High Order Functions Prelude> twice f x = f (f x) Prelude> twice (*2) 3
 12 Prelude> twice reverse [1,2,3] [1,2,3] Sum of the squares of all even numbers from 1 to 100? sum: adds items from a list
 square: already defined
 filter: filter list elements
 even: true if a number is even, false otherwise Prelude> sumsqreven ns = sum(map (square) (filter even ns)) Prelude> sumsqreven [1..100] 171700
  • 13. Function Composition Prelude> double x = x + x Prelude> triple x = double x + x Prelude> sixTimes = double . triple Prelude> sixTimes 5 30
  • 14. Function Composition Prelude> fsum = sum . map (square) . filter even Prelude> [1..100] [1,2,3,4,5,6,7,…] Prelude> fsum [1..100] 171700 Prelude> verifyStatus = … Prelude> checkCredit = … Prelude> validate = … Prelude> generateOrder = … Prelude> sendEmail = … Prelude> applyTransaction = sendEmail . generateOrder . validate . checkCredit . verifyStatus
  • 15. Pattern Matching Prelude> head [1..10] 1 Prelude> tail [1..10] [2,3,4,5,6,7,8,9,10] Prelude> length [] = 0 Prelude> length (_:xs) = 1 + length xs Prelude> length [] 0 Prelude> length [2,2,2,2,2,2,2] 7 Prelude> cabeca (x:xs) = x 1 Prelude> cauda(x:xs) = xs [2,3,4,5,6,7,8,9,10] Prelude> cabeca (x:_) = x Prelude> cauda(_:xs) = xs
  • 16. Pattern Matching Prelude> check (403, ip, timestamp) = ip Prelude> check (_, _, _) = “ok” Prelude> analyzelog xs = [check x | x <- xs] Prelude> analyzelog [
 (200, “200.251.192.13”, 1467313969905), 
 (403, “200.168.175.28”, 1467314005735), 
 (500, “201.52.164.78, 1467314029977) ] “ok” “200.168.175.28” “ok”
  • 17. Lazy Prelude> mult (x, y) = x * y Call by value > mult (1+2, 3+4) { applying + } mult (3, 3 + 4) { applying + } mult (3, 7) { applying mult } 3 * 7 { applying * } 21 Call by name > mult (1+2, 3+4) { applying mult } (1+2) * (3+4) { applying + } 3 * (3 + 4) { applying + } 3 * 7 { applying * } 21 Haskell strategy is based on call-by-name
  • 18. Lazy Prelude> list = 1 : 2 : [] [1,2] Call by value > head ones { applying ones } head (1 : ones)
 { applying ones } head (1 : (1 : ones))
 { applying ones } . . . > ones = 1 : ones > ones { applying ones } 1 : ones { applying ones } 1 : (1 : ones ) { applying ones } 1 : (1 : (1 : ones)) [1, 1, 1, 1, 1, 1, 1, 1, 1…]
  • 19. Lazy Prelude> list = 1 : 2 : [] > ones = 1 : ones > ones { applying ones } 1 : ones { applying ones } 1 : (1 : ones ) { applying ones } 1 : (1 : (1 : ones)) [1, 1, 1, 1, 1, 1, 1, 1, 1…] Call by name > head ones { applying ones } head (1 : ones)
 { applying head } 1
  • 20. Immutability > combine a b = a ++ b > combine [1,2,3] [4] [1,2,3,4] > let x = [1,2,3] > combine x [4] [1,2,3,4]
 > x [1,2,3]
 > drop 1 x [2,3]
 > x [1,2,3]
  • 21. Referential Transparency > incr a = a + 1 > incr 6 7
  • 22. Breaking Ref Transparency class OrderCalculator { Order _order; public Calculator (Order order){
 _order = order; } public void applyDiscount() {
 _order.total *= 0.90; } public void applyDeliveryTax() { _order.total += 10; } public double getTotal() { return _order.total; } } // set order total Order o = new Order(100); OrderCalculator oc = new OrderCalculator(o); oc.applyDeliveryTax(); oc.applyDiscount(); oc.getTotal(); //99 o = new Order(100); oc = new OrderCalculator(o); oc.applyDiscount(); oc.applyDeliveryTax(); oc.getTotal(); //100
  • 23. Pure 1. The function always evaluates the same result value given the same argument value(s). The function result value cannot depend on any hidden information or state that may change while program execution proceeds or between different executions of the program, nor can it depend on any external input from I/O devices.
 2. Evaluation of the result does not cause any semantically observable side effect or output, such as mutation of mutable objects or output to I/O devices. read data write data raise exception change state …
  • 24. Monads A monad is a way to structure computations in terms of values and sequences of computations using those values.
 It is a parameterized type m that supports return and bind functions of the specified types. class Monad m where
 return :: a -> ma
 (>>=) :: ma -> (a -> mb) -> mb It allows computation to be isolated from side-effects and non- determinism.
  • 25. More? Enjoy this track :) Programming in Haskell - Graham Hutton Real World Haskell - http://book.realworldhaskell.org/read/ Learn You a Haskell for Great Good - http://learnyouahaskell.com A Gentle Introduction to Haskell - https://www.haskell.org/tutorial/
 Introduction to Functional Programming - Erik Meijer - edX Don’t Fear the Monad (search on youtube) - Brian Beckman