


















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































Steve Zhang
@CiaD team in Scotiabank
I am Passionate about:
TDD, XP, Clean Code
Software craftsmanship
Learning, deliberate
practice
Pure
Elegant
Powerful
Anything that is
“effectively computable”
can be computed by a
Universal Turing
Machine.
Alan Turing
Anything that is
“effectively computable”
can be computed by
via λ Calculus.
Alonzo Church
Head
Body
(Expression)
Argument
Turing machine Lambda Calculus
Imperative Programming
Assembly
C / C++
Java
JavaScript
OO …
Functional Programming
Lisp
Erlang
Haskell
Scala
F# ….
A Programming paradigm based on
functions
Function is a first class citizen
can be a variable
passed as argument
return as a value
Roots in Lambda calculus
Same input always get the same result
Every subexpression can be substituted
by any other that’s equal to it in value
Easier to reason
RT functions will NOT
print on screen
output logs
Data can’t be changed after it’s been
created
No assignment
No shared state
void quicksort (int *A, int len ) {
if ( len < 2) return ;
int pivot = A [ len / 2] ;
}
int i, j;
for ( i = 0 , j = len - 1 ; ; i++, j-- ) {
while ( A [ i ] < pivot ) i++;
while ( A [ j ] > pivot ) j--;
if ( i >= j ) break ;
int temp = A [ i ] ;
A [ i ] = A [ j ] ;
A [ j ] = temp;
quicksort ( A, i ) ;
quicksort ( A + i, len - i ) ;
}
quicksort :: Ord a => [a] ->
[a] quicksort [] = []
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
where
lesser = filter (< p) xs
greater = filter (>= p) xs