PDA

View Full Version : Any advatage using the ML programming language?


chrisalviola
Jan9-11, 09:34 PM
been learning ML programming, just fun to learn new things, what this ML programming used for anyways? how is this better that C or C++?

DavidSnider
Jan15-11, 03:00 PM
C and C++ are known as imperative languages while ML is a functional language.

You can say that a C program "executes instructions" while an ML program "evaluates expressions".

Functional languages tend to treat programs as mathematical functions that don't have mutable data or state. This is to avoid functions having "side effects".

So in C, you can call a function twice with the same input data and get back two different results depending on the current state of the program. In ML a function always returns the same result for a given input regardless of the context. (Well, not *always* as ML is not a purely functional language, but usually).

This is said to make reasoning about the programs behavior easier.