Microsoft F# and functional programming

1,387 views

Published on

This presentation was designed to introduce you to the world of functional programming and the F# programming language from Microsoft.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Microsoft F# and functional programming

  1. 1. and functional programming
  2. 2. Presentation Agenda1. Motivation & history2. Features of F# language3. Abilities of functional programming4. F# code examples F# and functional programming ‐ Radek Míka 2
  3. 3. What is F# About? New functional language from Microsoft Why is Microsoft investing in functional  programming?  F# and functional programming ‐ Radek Míka 3
  4. 4. What is F# About? New functional language from Microsoft Why is Microsoft investing in functional  programming?  Powerful language  Simplicity  Programmers productivity  Scalability  F# and functional programming ‐ Radek Míka 4
  5. 5. What is F# About? F# is multi‐paradigm  .NET language  Functional programming  Object oriented programming  Imperative programming  .NET ‐> built on CLI  Statically typed language F# and functional programming ‐ Radek Míka 5
  6. 6. About History Project since 2002 at Microsoft Research January 2008 – first CTP Full support in Visual Studio 2010 F# and functional programming ‐ Radek Míka 6
  7. 7. Functional Programming SAYING “WHAT” RATHER THAN “HOW”  “how”  = imperative way  “what” = declarative way (better readable) Immutability Parallel & async. programming (scalability) F# and functional programming ‐ Radek Míka 7
  8. 8. Functional Languages Expressible languages But why?  Easy testing  Scalability  Processing large sets of data  Effectiveness F#, C#, Haskel, Erlang, Scala, Lisp F# and functional programming ‐ Radek Míka 8
  9. 9. Code//F# //C#open System using System;let a = 2 namespace ConsoleApplication1Console.WriteLine a { class Program { static int a() { return 2; } static void Main(string[] args) { Console.WriteLine(a); } More Noise  } Than Signal! } F# and functional programming ‐ Radek Míka 9
  10. 10. F# Pleasure C# Pain abstract class Commandtype Command = Command of (Rover ‐> unit) { public virtual void Execute(); }let BreakCommand =  abstract class MarsRoverCommand : Command Command(fun rover ‐> rover.Accelerate(‐1.0)) { protected MarsRover Rover { get; privlet TurnLeftCommand =  Command(fun rover ‐> rover.Rotate(‐5.0<degs>)) public MarsRoverCommand(MarsRover rov { this.Rover = rover; } } class BreakCommand : MarsRoverCommand { public BreakCommand(MarsRover rover) : base(rover) { } public override void Execute() { Rover.Rotate(‐5.0); } } class TurnLeftCommand : MarsRoverCommand {… F# and functional programming ‐ Radek Míka 10
  11. 11. Summary F# is multi‐paradigm language, mainly functional  Powerful  Flexible syntax  Shorter & elegant code  Increase productivity  Parallel & async. programming = extremely easy F# and functional programming ‐ Radek Míka 11
  12. 12. Sources http://www.fsharp.net• Real World Functional Programming  • Programming F# (Chris Smith) (Tomas Petricek, John Skeet) F# and functional programming ‐ Radek Míka 12
  13. 13. Questions F# and functional programming ‐ Radek Míka 13
  14. 14. The End Radek Míka radek@radekmika.cz

×