Erlang is not the only functional programming language for concurrency and paralellism.
In fact, all functional languages are designed for concurrency and paralellism.
The main reason is that functional programming assumes that input variables can't be changed and the only way to communicate the computation of a function is to return a value, therefore all side effects are eliminated and therefore all functions can be evaluated simultaneously without side effects.
In Haskell, you can even pass the world around.
Variables are also functions
"What?" I hear you say. Imagine you can define in Lisp a function like this:
(defun f (x) (2) )
It means that no matter whata parameter you pass to the f function, it will return 2. This is the same as a constant in C or Java.
But in Lisp you can change the function at runtime:
(defun f (x) (3) )
So it is more like a variable.
Most of the time isp is presented in the opposite way: Functions are first class elements, so that they can be passed as parameters, assigned to variables and returned from functions. Actually each of them implies the other 2.
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario