An Overview of Functional Programming

 

Obscure syntax, missing looping constructs, unknown programming patterns, the lack of libraries or documentation, there are a lot of reasons discouraging imperative programmers to start learning and using functional programming languages.

Microsoft released in 2002 F#, a multi-paradigm programming language, targeting the .NET Framework, that encompasses functional programming as well as imperative and object-oriented programming disciplines to help address these issues.

F# is first class .NET language, it has a complete access to the .NET Framework, can consume and generate classes, can be either interpreted or compiled to .NET assemblies, and it is well integrated to the Visual Studio Microsoft IDE.

Through a series of articles I would like to introduce some of the powerful F# features and features common to functional languages:

  1. Recursion - Where are my for/while loops?
    Discussion about recursion and why loops are rarely used in functional programming.
  2. List – Cons, Car, Cdr & Co
    Showing the importance and the power of list processing in functional languages.
  3. Pattern Matching – Be Explicit
    A great feature to write clear and concise code.
  4. 1st Class Functions – Power is in simplicity
    What does it mean to have first class functions, partial application, how to build abstraction with functions.
  5. Generic Parameters – Static typing without typing
    Presentation of generic parameters which will help you to make generalist and reusable algorithms.
  6. Sequences – Being lazy is allowed
    Usage of laziness to create on demand computations, and infinite streams of data.
  7. Workflows – A Monad alias
    Introduction to the concept of monads, how they can be built in F# and what the power they provide. 
  8. Quotations – Say “your name”
    An overview of meta-programming in F#.
  9. Continuations – Future is yours
    Continuations allow non lexical escapes, it is then possible to get coroutines , exception handling, recursion optimizations and more.
  10. Macros – Do you like parenthesis?
    This article will presents IronScheme, a Scheme implementation for the .NET, in order to speak about macros in functional programming

Learning functional programming when coming from the imperative world is not something easy, it takes time, but I encourage all of you to try it, since this mind shift will not only help you become better programmers by mastering new concepts, but it will also bring you a lot of fun!