F# (F Sharp) An Introductory Look By Kody Myers. History “Mathematicians stand on each others'...

Click here to load reader

  • date post

  • Category


  • view

  • download


Embed Size (px)

Transcript of F# (F Sharp) An Introductory Look By Kody Myers. History “Mathematicians stand on each others'...

  • Slide 1
  • F# (F Sharp) An Introductory Look By Kody Myers
  • Slide 2
  • History Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes. - Richard Hamming, 1968 Turing Award recipient
  • Slide 3
  • Lambda Calculus (-calculus) A formalism for representing functions. Formulated by Alonzo Church in the 1930s. Formed the basis of functional programming.
  • Slide 4
  • Early Functional Languages Lisp 1958 ISWIM (If you See What I Mean) 1966 Metalanguage (ML) 1973 Caml 1985 Haskell - 1990
  • Slide 5
  • "There are only two kinds of programming languages: those people always bitch about and those nobody uses. - Bjarne Stroustrup, Creator of C++
  • Slide 6
  • Why Nobody Uses Functional Languages Article appeared in the ACM SIGPLAN Notices newsletter in 1998 by Philip Wadler. Wadler was one of the principal designers of Haskell.
  • Slide 7
  • [] there are a large number of factors that hinder the widespread adoption of functional languages. To be widely used, a language should support interlanguage working, possess extensive libraries, be highly portable, have a stable and easy to install implementation, come with debuggers and profilers, be accompanied by training courses, and have a good track record on previous projects. -- Philip Wadler
  • Slide 8
  • Slide 9
  • Don Syme Principal Researcher at Microsoft Research, Cambridge, UK. Was working on generics for C# for the.NET Framework. Tasked with finding a functional language that would be a good fit with.NET.
  • Slide 10
  • Haskell.NET? We had a go doing Haskell for.NET. We actually got a long way in doing that, but in the end there is quite a lot of dissonance between Haskell and.NET. - Don Syme
  • Slide 11
  • Okay, How About OCaml.NET, Then? OCaml: Objective Caml Dialect of Caml. Descendent of Metalanguage (ML).
  • Slide 12
  • F# 1.0 May 2005 Functional programming Discriminated unions Records Tuples Pattern matching Type abbreviations Object programming Structs Signature files Scripting files Imperative programming Modules (no functors) Nested modules.NET Interoperability
  • Slide 13
  • F# 2.0 April 2010 Active patterns Units of measure Sequence expressions Asynchronous programming Agent programming Extension members Named arguments Optional arguments Array slicing Quotations Native interoperability Computation expressions
  • Slide 14
  • F# 3.0 August 2012 Type providers LINQ query expressions CLIMutable attribute Triple-quoted strings Auto-properties Provided units-of-measure
  • Slide 15
  • Present Day
  • Slide 16
  • F# 3.1 October 2013 Named union type fields Extensions to array slicing Type inference enhancements **Specification not yet finalized
  • Slide 17
  • Currently Active Keywords abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let let! match member module mutable namespace new not null of open or override private public rec return return! select static struct then to true try type upcast use use! val void when while with yield yield!
  • Slide 18
  • Inactive Keywords From OCaml asr land lor lsl lsr lxor mod sig
  • Slide 19
  • Reserved Keywords for Future Use atomic break checked component const constraint constructor continue eager event external fixed functor include method mixin object parallel process protected pure sealed tailcall trait virtual volatile
  • Slide 20
  • Introducing your let-saber A more elegant weapon for a more civilized age. - Obi Wan Kenobi, Star Wars: A New Hope
  • Slide 21
  • let Us Begin let hello = Hello World! let pi = 3.1415926 let isRunning = false let numList = [1.. 10] let vehicle = (2013, Ford, Explorer, true) let userId = System.Guid.NewGuid()
  • Slide 22
  • Wow, Those Puns Were Terrible Yeah, youre probably right. Time to lose these boring slides for awhile.
  • Slide 23
  • Advantages of F# Highly readable, especially for developers who are already with functional languages and.NET programming. Highly writeable, especially developing with the help of the Visual Studio IDE. Highly reliable, thanks to the tried and heavily-tested libraries of the.NET Framework. Moderately portable to other, non-Windows platforms, thanks to the Mono project.
  • Slide 24
  • Disadvantages of F# Functional languages require an uncomfortable adjustment to the way programmers normally think about problems. Sacrifices a measure of performance in favor of reliability. Hasnt garnered a comparable amount of confidence as the other more well- established languages of the.NET Framework. Practical solutions are limited to very specific class of problems.
  • Slide 25
  • The Future: F# 4.0+ Printf on unitized values Extension property initializers Non-null provided types Class names as functions Static parameters for provided methods Printf interpolation Extended #if grammar Support for 'fixed' Tailcall attribute Multiple interface instantiations Optional type args Params dictionaries
  • Slide 26
  • A Sampling of Practical Applications Unit conversion Power generation load balancing and scheduling Insurance risk engine Game rules engine Website click prediction Forensic image comparison Genome sequencing Game player ranking let isFSharpUseful = true Source: http://fsharp.org/testimonials/
  • Slide 27
  • Suggested Resources Try F# tryfsharp.org The F# Software Foundation fsharp.org F# for fun and profit fsharpforfunandprofit.com