Friday, October 28, 2011
Functional Program F#
F# is ideal for data-rich, concurrent and algorithmic development: "simple code to solve complex problems". F# is a simple and pragmatic programming language combining functional, object-oriented and scripting programming, and supports cross-platform environments including PC, Mac, and Linux.
How functional program differs from traditional normal programs?
Every computer program takes input in some form and produces output in some form. That input may be generated by keystrokes on the keyboard, from data bytes in a disk file, by a stylus on a touch sensitive screen, or in many other ways. However, when the input reaches the program, it has been converted to bit patterns (and these are equivalent to numbers). The program's output may take the form of characters or images drawn on a screen, data bytes written to a file, sounds emitted by a speaker, or many other forms again. However, the program itself generates only bit patterns to produce all these different kinds of output.
In its simplest form, a computer program inputs numbers and produces numbers as its result. With this viewpoint, a program is very similar in nature to a mathematical function. For example, the line of mathematics
let h = sin(π/4)
could be viewed as a request to evaluate the sine function with π/4 as its input and to use the name h for the output, i.e. the function result.
Microsoft Research Cambridge says, ‘F is for Fun.’ Isn't!