"Introduction to F#" - South Dakota Code Camp, November 5, 2011
-
Upload
blend-interactive -
Category
Technology
-
view
780 -
download
4
description
Transcript of "Introduction to F#" - South Dakota Code Camp, November 5, 2011
Introduction to F#
What’s a Seth?
• SD Native • Graduated a couple times • Developer – Blend Interactive • Consultant • Founder – Sioux Falls Developers Group • Cofounder – This thing we’re at today
Who are you?
• Java peoples? • .Net people? • Python/Ruby people? • Why are you interested?
Goals
• Give a little background • Explain some of the basic FP ideas • Cover F# syntax basics
• Converting you to FP and F# is NOT my goal
Functional Programming • First Class Functions • Higher-Order Functions • No Shared State • No Side Effects • Immutable data • Recursion
Functional Principles
• Composition over Inheritance
• Separate functions from data
• Referential Transparency
Composition Over Inheritance
• Write functions that transform known input to known output
• Output of one function is input to the next
• Things like LINQ o Repeater.DataSource = myList.Where(x=> x.Length >
5).OrderBy(x=>x.Name);
Separate Functions From Data
• But why wouldn’t you want possibly re-usable functionality tightly bound to a specific data type?
Together Separate • Method(x)
• But what if we want to use it on y?
• Method(y) • darn
• x.Method()
• Our brains probably
prefer this way, nothing wrong with that
• Since C# is taking on some FP concepts extension methods semi-allow for this
Referential Transparency • ???
• When it comes to null references
F# isn’t just functional • So I’m kind of wasting your time right?
• F# is multi-paradigm, but “functional first” o Object Oriented – Smalltalk o Functional – Lisp, Scala, Haskell, OCaml, etc. o Imperative – C
• "I like to think of F# as a strongly typed python for .net” – Don Syme, MS Research/Creator of F#
Object Oriented Encapsulation
Inheritance Polymorphism
Demo
What industries? • Finance • Front Office • Banking • Games • 3D Graphics • Telecoms • Investment Banks • Advertising
What companies? • Optiver • EDF • Computational Problems • Credit Suisse • Data Analytics • Measured Progress • guardian.co.uk
Questions