% A Taste Functional Programming with Haskell
% Haisheng, Wu
% App, 2014
AGENDA
Functional Programming
Haskell Features
Practical examples
"Hello World" in Haskell
Resources
Functional Programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data.
Functional Programming (Cont.)
Treats computation as a series of mathematical functions (functional style)
Subset of compositional programming (pipe in Unix?)
Avoids states and mutable data.
Immutable
Purity
Functions a first class
functions can be a argument (HOF)
functions can be the return value
Abstraction
Mathematics model (when solving problems)
Currying
Recursive / Tail Call Optimisation
Expressions v.s Statements
Summing the integers 1 to 10 in Java
Java
int total = 0;
for (i = 1; i <= 10; ++i) {
total = total+i;
}
% A Taste Functional Programming with Haskell % Haisheng, Wu % App, 2014
AGENDA
Functional Programming
Summing the integers 1 to 10 in Java
Haskell Features
Haskell in one slide
by SPJ
Purely functional
High order functions
Currying
bind function in JavaScript
Function composition
Statically typed
f :: Int -> Int
null
value? then what is the type?Pattern matching
Practical example
Trivial Abstraction example
notes: code written in JavaScript
The ancient RC process
I would like to make change to
search-ecomm_13_12.js
and I need tosearch-ecomm_13_12.js
P4 edit
those TML files.../resources/mojito/.../search-ecomm_13_12.js
.../RC/mojito/.../search-RC.js
.../resources/mojito/.../search-ecomm_13_12.js
.../RC/mojito/.../search-RC.js
p4 add
itsearch-RC.js
Can a tool help me out like:
The ancient RC process - Types
Translate the scenario straightforwardly
The ancient RC process - Show me the code
Quick start a Hello world
ghc
ghci
runghc
hello-world.hs
with contentResources
Thank you