Find the answer to your Linux question:
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.
  1. #1
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942

    Functional languages vs. imperative ones


    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 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!

  2. #2
    Linux User IsaacKuo's Avatar
    Join Date
    Feb 2005
    Location
    Baton Rouge, LA, USA
    Posts
    406
    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

  3. #3
    Linux User
    Join Date
    Jul 2004
    Location
    Poland
    Posts
    368
    Quote Originally Posted by IsaacKuo
    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.
    Well, I guess this needn't be the case. Just take a look at
    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"

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •