khanhtc's blog | 👀 RSS 👌

Imperative vs Functional

Difference between Imperative languages and Functional languages:

  • Imperative languages are based on assignment sequences whereas functional languages are based on nested function calls.

  • In imperative languages, the same name may be associated with several values, whereas in functional languages a name is only associated with one value.

  • Imperative languages have fixed evaluation orders whereas functional languages need not.(1)

  • In imperative languages, new values may be associated with the same name through command repetition whereas in functional languages new names are associated with new values through recursive function call nesting.

  • Functional languages provide explicit data structure representations.

  • In functional languages, functions are values.(2)

  • Functional languages originate in mathematical logic and the theory of computing, in recursive function theory and lambda calculus.

(1). Remember the difference between statements and expressions. Statements do not yield a result value whereas expressions do.

(2). Most of modern languages nowaday support syntax in which accept a function as parameter for a function, but in functional languages, functions can be return as the return of functions.