Scanning the Internet for External Cloud Exposures via SSL Certs
Functional programming
1. Functional programming
Very very brief introduction ----- -------- O. Teytaud
Can you define a function f such that:
- there's no randomness
- nonetheless, if you call f twice,
you get two distinct results ?
2. Functional programming
Very very brief introduction ----- -------- O. Teytaud
Can you define a function f such that:
- there's no randomness or clock
- nonetheless, if you call f twice,
you get two distinct results ?
Yes:
double f(double x)
{
Static double sv=0;
sv++;
Return x+sv;
}
3. Functional programming
Very very brief introduction ----- -------- O. Teytaud
Can you define a function f such that:
- there's no randomness or clock
- nonetheless, if you call f twice,
you get two distinct results ?
Yes (other solution):
double f(double x)
{
Return x+y; // y = global variable
}
4. Functional programming
Very very brief introduction ----- -------- O. Teytaud
This is termed a “side effect”: you apply
function f on data x and this modifies sv...
C, C++, and many “classical” languages
allow side effects.
Some people consider that side effects must
be forbidden by programming languages.
==> functional programming.
5. Functional programming
Very very brief introduction ----- -------- O. Teytaud
Fundamental property of
functional programming:
myFunction(thisFunction(x),y,z+otherFunction)
at 3pm in Taiwan
has the same result as
myFunction(thisFunction(x),y,z+otherFunction)
at 5 pm in Switzerland
whatever may be the memory of the computer.
6. Functional programming: examples
Existing implementations of
functional programming:
ObjectiveCaml
CommonLisp
Haskell
F#
...and also in specialized languages:
R
Mathematica
8. Functional programming: a classical joke
It's impossible to do dirty programming in
ObjectiveCaml.
But this does not mean that it is possible
to do programming in ObjectiveCaml.
9. Functional programming: a classical joke
It's impossible to do dirty programming in
ObjectiveCaml.
But this does not mean that it is possible
to do programming in ObjectiveCaml.
(it is also impossible to do dirty
programming with my left shoe;
it does not imply that my left shoe
is a good programming language)
10. Functional programming: decide
I've tested ObjectiveCaml.
Yes, it's cool: no dirty programming, stable
code.
I definitely prefer C++ (closer to the (my?) human way
of thinking...) for a fast development, but it might
be true that functional programming should be
used in cases in which you can't test.
Example: the code which was responsible of
the explosion of Ariane 5. Testing in
real conditions is difficult...
11. Functional programming: real life
Some development competitions have been
won by teams working with functional programming.
E.g.: Facebook tchat servers use Erlang; and
ObjectiveCaml is now widely used.
You can also do “quasi”-functional programming
in C++: just do not use
- global variables,
- static variables,
- dirty processor-dependent optimizations.