Re: Functional languages.
essentially, high-speed mathematical computations.... where time and accuracy is most important.
-tg
Re: Functional languages.
Quote:
Originally Posted by techgnome
essentially, high-speed mathematical computations.... where time and accuracy is most important.
-tg
Ah yes speed..didnt think of that. But our teacher also mentioned that they do not use memory, so values etc cant be saved in memory, I suppose that also is for speed? Results etc has to be printed directly to the output device (screen, printer etc) instead of being saved somewhere..
EDIT: which also brings me to this..if you cant save values in memory, isnt it hard to perform advanced mathematical calculations without being able to use variables to store numbers?
Re: Functional languages.
What it means is that it's in a volatile state. Cut the power, all is lost. Nothing can be saved. That's actually a simplistic view of it.... think of it this way. A function returns a value. That means you can use the result of that function to pass as a parameter to antother function,.... whose result can then also be used as a parameter to yet another function - All inline... meaning no variables to hold the results... Generally these languages also support Lambda expressions, where the function is defined inline as well. This is getting more and more notice as the next round of .NET will have some Lambda expression support.
-tg
Re: Functional languages.
Oh ok. Thanks for that explanation:D
I'd like to try out some coding in Lisp..
Re: Functional languages.
Not using memory is rubbish. Everything uses memory. The difference is that procedural/OO languages use state whereas functional languages emphasise lack of it.
http://en.wikipedia.org/wiki/Functional programming
Some features of functional languages such as composition make them much more powerful than procedural languages, but more specialised. Essentially they require a completely different approach to solving problems.
Purely functional languages have limited use; multi-paradigm languages are more common (Lisp is multi-paradigm rather than purely functional).
Since state is a 'necessary evil', if you will, in most programming, pure functional languages use tricks like monads whereas multi-paradigm languages can use techniques from imperative programming.