|
-
Sep 11th, 2007, 01:26 PM
#1
Functional languages.
Alright Ive just started my programming education on university and the last lecture was about the different programming languages.
One thing that puzzled me was about the group called "Functional languages" (Lisp for example), our teacher said it uses mathematical expressions and functions, and nothing more.
It made me think...doesnt that make such languages pretty useless? I mean what can you do with them? Can you even write to / read from files? Not trying to bash the "Functional Languages", Im just curious...what are the advantages and where are they used?
-
Sep 11th, 2007, 01:36 PM
#2
Re: Functional languages.
essentially, high-speed mathematical computations.... where time and accuracy is most important.
-tg
-
Sep 11th, 2007, 01:42 PM
#3
Re: Functional languages.
 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?
Last edited by Atheist; Sep 11th, 2007 at 01:53 PM.
-
Sep 11th, 2007, 02:20 PM
#4
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
-
Sep 11th, 2007, 04:11 PM
#5
Re: Functional languages.
Oh ok. Thanks for that explanation
I'd like to try out some coding in Lisp..
-
Sep 13th, 2007, 06:43 AM
#6
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|