"introduction to f#" - south dakota code camp, november 5, 2011

16
Introduction to F#

Upload: blend-interactive

Post on 08-May-2015

780 views

Category:

Technology


4 download

DESCRIPTION

Seth Larson's presentation to South Dakota Code Camp about F#.

TRANSCRIPT

Page 1: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Introduction  to  F#

Page 2: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

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

Page 3: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Who  are  you?

•  Java peoples? •  .Net people? •  Python/Ruby people? •  Why are you interested?

Page 4: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

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

Page 5: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Functional  Programming •  First Class Functions •  Higher-Order Functions •  No Shared State •  No Side Effects •  Immutable data •  Recursion

Page 6: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Functional  Principles

•  Composition over Inheritance

•  Separate functions from data

•  Referential Transparency

Page 7: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

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);

Page 8: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Separate  Functions  From  Data

•  But why wouldn’t you want possibly re-usable functionality tightly bound to a specific data type?

Page 9: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

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

Page 10: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Referential  Transparency •  ???

•  When it comes to null references

Page 11: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

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#

Page 12: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Object  Oriented Encapsulation

Inheritance Polymorphism

Page 13: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Demo

Page 14: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

What  industries? •  Finance •  Front Office •  Banking •  Games •  3D Graphics •  Telecoms •  Investment Banks •  Advertising

Page 15: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

What  companies? •  Optiver •  EDF •  Computational Problems •  Credit Suisse •  Data Analytics •  Measured Progress •  guardian.co.uk

Page 16: "Introduction to F#" - South Dakota Code Camp, November 5, 2011

Questions