SlideShare une entreprise Scribd logo
1  sur  20
Introduction to F# 3.0
Talbott Crowell, MVP
@talbott

#BOSCC
Boston Code Camp
October 20, 2012
What is F#
Statically typed, open source
  functional programming
           language
 that uses type inferencing
       Unique features:
        Units of Measure
         Type Providers
Static versus Dynamic
F# is statically typed like:
  C++, Objective-C, Java, Scala


Compared to dynamically typed
languages:
  Python, JavaScript, Erlang, MATLAB
Open Source
Apache 2.0 license
Free IDE on Windows from Microsoft
Free IDE on Mac (MonoDevelop)

http://blogs.msdn.com/b/fsharpteam/archive/2012/09/24/announcing-the-f-3-0-open-source-code-drop.aspx
Functional Programming
           (FP)
Examples of FP languages
  Erlang, Haskell,
  Clojure and Scala (JVM)


Functions are first class citizens
  like variables in imperative languages
Higher-order functions
  functions a parameters or return values
Type Inferencing
let   x = 5
let   y = "hello"
let   z = new Form()
let   distance = 26.21875<mile>
let   f x = x + x
Immutable by default
let x = 5
let mutable y = 7
y <- 8

let z = new Form()
z.Show()
z.Text <- “Hello”
Array, List, and Seq
Arrays are mutable

Lists are not

Seq (sequences) only store one
value at a time (lazy)
Array, List, and Seq
let set1 = [|1..10|]
let set2 = [1..10]
let set3 = seq { 1..10 }

set1.[0] <- 999 //mutable
Units of Measure
Floating point and signed integer
values in F# can have associated
units of measure, which are typically
used to indicate
length, volume, mass, and so on.

By using quantities with units, you
enable the compiler to verify that
arithmetic relationships have the
correct units, which helps prevent
programming errors.
Units of Measure
[<Measure>] type mile
[<Measure>] type km

let distance1 = 4.0<mile>
let distance2 = 3.0<km>
//compile error
let total = distance1 + distance2
Units of Measure
[<Measure>] type mile
[<Measure>] type km
let convert_mile2km (a : float<mile>) =
     a / 0.621371<mile/km>

let distance1 = 4.0<mile>
let distance1a = convert_mile2km distance1
let distance2 = 3.0<km>

let total = distance1a + distance2
Type Providers
F# 3.0 introduces
Type Providers

Data rich programming
for the Big Data Era

Enables
massive schemas
with strict typing
Examples of Type Providers
        SQL Data Connection
 OData Service Provider (Netflix)
              Freebase
               Hadoop
                  R
                 WMI
                RegEx
Type Provider Demo
TryFsharp.org
FPish.net
Other Resources
http://stackoverflow.com/questions/tagged/f%23

http://fsharpsamples.codeplex.com/




http://fsharp.net
Questions?
Thank You
Follow me on Twitter
    @Talbott

Contenu connexe

Tendances

Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
rawan_z
 

Tendances (19)

Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
C tutorial
C tutorialC tutorial
C tutorial
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
C and C ++ Training in Ambala ! BATRA COMPUTER CENTRE
C and C ++ Training in Ambala ! BATRA COMPUTER CENTREC and C ++ Training in Ambala ! BATRA COMPUTER CENTRE
C and C ++ Training in Ambala ! BATRA COMPUTER CENTRE
 
C vs c++
C vs c++C vs c++
C vs c++
 
C language
C languageC language
C language
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Aniket tore
Aniket toreAniket tore
Aniket tore
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
 
C basics
C   basicsC   basics
C basics
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C Basics
 
basics of c++
basics of c++basics of c++
basics of c++
 
Yacc (yet another compiler compiler)
Yacc (yet another compiler compiler)Yacc (yet another compiler compiler)
Yacc (yet another compiler compiler)
 
C notes for exam preparation
C notes for exam preparationC notes for exam preparation
C notes for exam preparation
 

Similaire à Introduction to F# 3.0

Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
Adam Getchell
 

Similaire à Introduction to F# 3.0 (20)

Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
 
F# 101
F# 101F# 101
F# 101
 
Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharp
 
C programming course material
C programming course materialC programming course material
C programming course material
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
 
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
 
LLVM
LLVMLLVM
LLVM
 
F# Tutorial @ QCon
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QCon
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
Shanks
ShanksShanks
Shanks
 
Chapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptxChapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptx
 
Fun with lambda expressions
Fun with lambda expressionsFun with lambda expressions
Fun with lambda expressions
 
C material
C materialC material
C material
 
Golang online course
Golang online courseGolang online course
Golang online course
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
 

Plus de Talbott Crowell

Top 3 Mistakes when Building
Top 3 Mistakes when BuildingTop 3 Mistakes when Building
Top 3 Mistakes when Building
Talbott Crowell
 
Custom Development for SharePoint
Custom Development for SharePointCustom Development for SharePoint
Custom Development for SharePoint
Talbott Crowell
 
PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012
Talbott Crowell
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
Talbott Crowell
 
Automating PowerShell with SharePoint
Automating PowerShell with SharePointAutomating PowerShell with SharePoint
Automating PowerShell with SharePoint
Talbott Crowell
 

Plus de Talbott Crowell (17)

Top 7 mistakes
Top 7 mistakesTop 7 mistakes
Top 7 mistakes
 
Top 3 Mistakes when Building
Top 3 Mistakes when BuildingTop 3 Mistakes when Building
Top 3 Mistakes when Building
 
Building high performance and scalable share point applications
Building high performance and scalable share point applicationsBuilding high performance and scalable share point applications
Building high performance and scalable share point applications
 
Road to the Cloud - Extending your reach with SharePoint and Office 365
Road to the Cloud - Extending your reach with SharePoint and Office 365Road to the Cloud - Extending your reach with SharePoint and Office 365
Road to the Cloud - Extending your reach with SharePoint and Office 365
 
Custom Development for SharePoint
Custom Development for SharePointCustom Development for SharePoint
Custom Development for SharePoint
 
Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?
 
Developing a Provider Hosted SharePoint app
Developing a Provider Hosted SharePoint appDeveloping a Provider Hosted SharePoint app
Developing a Provider Hosted SharePoint app
 
Developing a provider hosted share point app
Developing a provider hosted share point appDeveloping a provider hosted share point app
Developing a provider hosted share point app
 
PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012
 
PowerShell and SharePoint
PowerShell and SharePointPowerShell and SharePoint
PowerShell and SharePoint
 
Welcome to windows 8
Welcome to windows 8Welcome to windows 8
Welcome to windows 8
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
 
Automating PowerShell with SharePoint
Automating PowerShell with SharePointAutomating PowerShell with SharePoint
Automating PowerShell with SharePoint
 
F# And Silverlight
F# And SilverlightF# And Silverlight
F# And Silverlight
 
SharePoint Saturday Boston 2010
SharePoint Saturday Boston 2010SharePoint Saturday Boston 2010
SharePoint Saturday Boston 2010
 
Automating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointAutomating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePoint
 
Architecting Solutions for the Manycore Future
Architecting Solutions for the Manycore FutureArchitecting Solutions for the Manycore Future
Architecting Solutions for the Manycore Future
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Introduction to F# 3.0

  • 1. Introduction to F# 3.0 Talbott Crowell, MVP @talbott #BOSCC Boston Code Camp October 20, 2012
  • 2. What is F# Statically typed, open source functional programming language that uses type inferencing Unique features: Units of Measure Type Providers
  • 3. Static versus Dynamic F# is statically typed like: C++, Objective-C, Java, Scala Compared to dynamically typed languages: Python, JavaScript, Erlang, MATLAB
  • 4. Open Source Apache 2.0 license Free IDE on Windows from Microsoft Free IDE on Mac (MonoDevelop) http://blogs.msdn.com/b/fsharpteam/archive/2012/09/24/announcing-the-f-3-0-open-source-code-drop.aspx
  • 5. Functional Programming (FP) Examples of FP languages Erlang, Haskell, Clojure and Scala (JVM) Functions are first class citizens like variables in imperative languages Higher-order functions functions a parameters or return values
  • 6. Type Inferencing let x = 5 let y = "hello" let z = new Form() let distance = 26.21875<mile> let f x = x + x
  • 7. Immutable by default let x = 5 let mutable y = 7 y <- 8 let z = new Form() z.Show() z.Text <- “Hello”
  • 8. Array, List, and Seq Arrays are mutable Lists are not Seq (sequences) only store one value at a time (lazy)
  • 9. Array, List, and Seq let set1 = [|1..10|] let set2 = [1..10] let set3 = seq { 1..10 } set1.[0] <- 999 //mutable
  • 10. Units of Measure Floating point and signed integer values in F# can have associated units of measure, which are typically used to indicate length, volume, mass, and so on. By using quantities with units, you enable the compiler to verify that arithmetic relationships have the correct units, which helps prevent programming errors.
  • 11. Units of Measure [<Measure>] type mile [<Measure>] type km let distance1 = 4.0<mile> let distance2 = 3.0<km> //compile error let total = distance1 + distance2
  • 12. Units of Measure [<Measure>] type mile [<Measure>] type km let convert_mile2km (a : float<mile>) = a / 0.621371<mile/km> let distance1 = 4.0<mile> let distance1a = convert_mile2km distance1 let distance2 = 3.0<km> let total = distance1a + distance2
  • 13. Type Providers F# 3.0 introduces Type Providers Data rich programming for the Big Data Era Enables massive schemas with strict typing
  • 14. Examples of Type Providers SQL Data Connection OData Service Provider (Netflix) Freebase Hadoop R WMI RegEx
  • 20. Thank You Follow me on Twitter @Talbott