Results 1 to 3 of 3
This isn't really a programming problem; it's more of a question actually. If this belongs in another forum, I'm sorry; this one just seemed most appropriate. I've been learning ML ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-03-2005 #1
Functional languages vs. imperative ones
I've been learning ML and LISP lately, and they refer to variable binding, which they say is completely different from variable assignment in a language like C. I personally see no difference...could anyone help clear this up?
Thanks in advance!
- 11-03-2005 #2
The big difference is that a variable in an imperative language is actually variable--the value can change! In a pure functional language a "variable" is not variable--the value can't change. The elegance of a pure functional language is that it doesn't matter what order the code is calculated in. Since a "variable" has a value which can't change, there's no problem with executing code related to that variable in any order, or even in parallel.
However, pure functional languages are not particularly useful or efficient in practice. In practice, the imperative model more closely fits what electronic computers are good at, and more closely fits the sorts of tasks we want computers to do.
Microprocessors are stupendously efficient at doing many sequential operations on a small number of rapidly changing "register" variables. That's basically what the imperative model calls for.
Microprocessors are not nearly as efficient at rapidly allocating/deallocating bits of memory and pushing/pulling stuff to/from the stack. That's basically what the functional model calls for.Isaac Kuo, ICQ 29055726 or Yahoo mechdan
- 11-03-2005 #3
Originally Posted by IsaacKuo
- Join Date
- Jul 2004
this benchmark. Looks like an ML and OCaml implementations are very high on the list. What do you think?"I don't know what I'm running from
And I don't know where I'm running to
There's something deep and strange inside of me I see"