SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Eriawan Kusumawardhono
ï‚Ą   F# is starting from a research project of
    Microsoft, created by Don Syme
ï‚Ą   F# is a functional programming language
    that runs on top of .NET
ï‚Ą   F# is now part of VS 2010 built in
    programming language
ï‚Ą   Also part of OCAML programming language
    family
ï‚Ą   There are many definitions about this, and
    there’s no simple standard definition
ï‚Ą   According to Erik Meijer and Brian Beckman
    of Microsoft, Functional Programming is
    programming with mathematical function,
    where function is a first class citizen of a
    program
ï‚Ą   A simple operation that returns a value, that
    can have a parameter or more than one
    parameters
f(x) = x+1
y=x+1
x=x+1
x++
F#                                 OOP (C#, VB, C++
)

ï‚Ą    Immutable by default          ï‚Ą   Mutable by default
ï‚Ą    Function is the same as       ï‚Ą   Function is treated as a
     data in a program, and can        method that must reside in
     be written as a standalone        a body of a class
     function                      ï‚Ą   ‘Noisy’ syntax
ï‚Ą    Succinct syntax               ï‚Ą   Type inference is only
ï‚Ą    Type inference is available       available since C# 3.0 and
     from the start                    VB 9.0, not in C++ and
                                       others
Comparison of F# to others such as C#, VB, C++
ï‚Ą   Immutable by default    ï‚Ą   Mutable by default

    let y = x + 1               x = x +1

ï‚Ą   Mutable is explicit     ï‚Ą   Immutable is explicit.
                                For example, in C#:
    let mutable x = x + 1        readonly x = 0


                            ï‚Ą   In VB:
                                 ReadOnly x As Integer
ï‚Ą   In F#, it can be           ï‚Ą   In C# and VB, it must
    standalone and simple          be enclosed in a
                                   class/module

    let f x = x +2                 class SimpleFunc
                                   {
                                       public static Int32
                                   f(Int32 x)
ï‚Ą   This is why it is called           {
                                           return x + 2;
    “succinct”                         }
                                   }

                               ï‚Ą   This is “noisy”
ï‚Ą   Already have at the first release
ï‚Ą   It is also a strong type language
ï‚Ą   Including built in support of Generic
ï‚Ą   The type inference is not just local type
    inference, but it then can be inferred based
    on the use of the parameters!
Int32
let avalue =10               String
let aName = ‘Hello’
let savingInterest = 0.2           Double
ï‚Ą   Type inference on functions when it’s used
                     let f x = sqr x + 1
                                            Infers integer
                         .. return type     from a whole
                          becomes int       number

let sqr x = x * x

                                             Infers double
                                            from a double
                                                literal..
                    let f x = sqr x + 1.0
Less noise syntax but it’s still strongly typed
ï‚Ą   Always begin with keyword “let”


      let avalue = 10
      let aName = ‘Hello’
      let savingInterest = 0.2
ï‚Ą   When there’s a need for explicit type system:


     let x:int = 0
     let piConstant:float = 3.141
     let Name:String = ‘Eriawan’
ï‚Ą   Always begin with let keyword

     let f x = x + 1
     let sqr y = y * y
     let force x = x * gravity
ï‚Ą   Parameters are written in a nice separation
    “juxtaposition” syntax: a space

          let sqr x = x * x
                               Function parameter

          let add a b = a + b
The code in F#
ï‚Ą   Multiple lines of code is using indentation:


       let rec fib x =
           if x < 2 then 1
           else fib (x–1) + fib (x-2)
ï‚Ą   Comment is the same with VB and C#
       // some code
       let x = x + 2

       // XML doc comment:

       /// <summary>A square function<summary>
       /// <param name=‚x‛>the value</param>
       let f x = x * x
The object oriented and imperative are here in F#
let f x = x *x
let g(x) = x* x
fun x -> x * x
ï‚Ą   Mutable is easy, by adding keyword
    “mutable”
ï‚Ą   Next operation of assignment must use “<-”
    to differentiate mutability.
              let mutable y = 10
              y <- y + 1
ï‚Ą   Creating enum is also easy:


                   type Suit =
                       | Heart
                       | Diamond
                       | Spade
                       | Club
type Vector2D(dx:float, dy:float) =
    // The pre-computed length of the vector
    let length = sqrt(dx*dx + dy*dy)
    /// The displacement along the X-axis
    member v.DX = dx
    /// The displacement along the Y-axis
    member v.DY = dy
    /// The length of the vector
    member v.Length = length
    // Re-scale the vector by a constant
    member v.Scale(k) = Vector2D(k*dx, k*dy)
ï‚Ą   It’s easy! Just create type but with abstract
    keyword as modifier for all functions and
    other members:

          type IPeekPoke =
              abstract Peek: unit -> int
              abstract Poke: int -> unit
Unit of measure in F# only!
[<Measure>]
type kg

[<Measure>]
type m

[<Measure>]
type s

let gravityOnEarth = 9.81<m/s^2>
let heightOfMyOfficeWindow = 3.5<m>
let speedOfImpact =
    sqrt (2.0 * gravityOnEarth + heightOfMyOfficeWindow)
Created by Eriawan Kusumawardhono, courtesy of RX Communica

Weitere Àhnliche Inhalte

Was ist angesagt?

Lec 42.43 - virtual.functions
Lec 42.43 - virtual.functionsLec 42.43 - virtual.functions
Lec 42.43 - virtual.functionsPrincess Sam
 
Virtual function
Virtual functionVirtual function
Virtual functionharman kaur
 
yield and return (poor English ver)
yield and return (poor English ver)yield and return (poor English ver)
yield and return (poor English ver)bleis tift
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppteShikshak
 
Kotlin Delegates: Reduce the boilerplate
Kotlin Delegates: Reduce the boilerplateKotlin Delegates: Reduce the boilerplate
Kotlin Delegates: Reduce the boilerplateDmytro Zaitsev
 
Bc0037
Bc0037Bc0037
Bc0037hayerpa
 
5 - OOP - Smalltalk in a Nutshell (c)
5 - OOP - Smalltalk in a Nutshell (c)5 - OOP - Smalltalk in a Nutshell (c)
5 - OOP - Smalltalk in a Nutshell (c)The World of Smalltalk
 
Interpreter Case Study - Design Patterns
Interpreter Case Study - Design PatternsInterpreter Case Study - Design Patterns
Interpreter Case Study - Design PatternsCodeOps Technologies LLP
 
C# Summer course - Lecture 3
C# Summer course - Lecture 3C# Summer course - Lecture 3
C# Summer course - Lecture 3mohamedsamyali
 
Dynamic Memory Allocation in C
Dynamic Memory Allocation in CDynamic Memory Allocation in C
Dynamic Memory Allocation in CVijayananda Ratnam Ch
 
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.Abu Saleh
 
Interpreter Design Pattern
Interpreter Design PatternInterpreter Design Pattern
Interpreter Design Patternsreymoch
 
Java Foundations: Basic Syntax, Conditions, Loops
Java Foundations: Basic Syntax, Conditions, LoopsJava Foundations: Basic Syntax, Conditions, Loops
Java Foundations: Basic Syntax, Conditions, LoopsSvetlin Nakov
 
Java essence part 1
Java essence part 1Java essence part 1
Java essence part 1HanRu Yeh
 
Back to the Future with TypeScript
Back to the Future with TypeScriptBack to the Future with TypeScript
Back to the Future with TypeScriptAleĆĄ Najmann
 
2013 lecture-02-syntax shortnewcut
2013 lecture-02-syntax shortnewcut2013 lecture-02-syntax shortnewcut
2013 lecture-02-syntax shortnewcutPharo
 

Was ist angesagt? (20)

Lec 42.43 - virtual.functions
Lec 42.43 - virtual.functionsLec 42.43 - virtual.functions
Lec 42.43 - virtual.functions
 
C++ Chapter I
C++ Chapter IC++ Chapter I
C++ Chapter I
 
Virtual function
Virtual functionVirtual function
Virtual function
 
yield and return (poor English ver)
yield and return (poor English ver)yield and return (poor English ver)
yield and return (poor English ver)
 
C++ Chapter III
C++ Chapter IIIC++ Chapter III
C++ Chapter III
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppt
 
Kotlin Delegates: Reduce the boilerplate
Kotlin Delegates: Reduce the boilerplateKotlin Delegates: Reduce the boilerplate
Kotlin Delegates: Reduce the boilerplate
 
Bc0037
Bc0037Bc0037
Bc0037
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
5 - OOP - Smalltalk in a Nutshell (c)
5 - OOP - Smalltalk in a Nutshell (c)5 - OOP - Smalltalk in a Nutshell (c)
5 - OOP - Smalltalk in a Nutshell (c)
 
Interpreter Case Study - Design Patterns
Interpreter Case Study - Design PatternsInterpreter Case Study - Design Patterns
Interpreter Case Study - Design Patterns
 
C# Summer course - Lecture 3
C# Summer course - Lecture 3C# Summer course - Lecture 3
C# Summer course - Lecture 3
 
Dynamic Memory Allocation in C
Dynamic Memory Allocation in CDynamic Memory Allocation in C
Dynamic Memory Allocation in C
 
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
 
Interpreter Design Pattern
Interpreter Design PatternInterpreter Design Pattern
Interpreter Design Pattern
 
Java Foundations: Basic Syntax, Conditions, Loops
Java Foundations: Basic Syntax, Conditions, LoopsJava Foundations: Basic Syntax, Conditions, Loops
Java Foundations: Basic Syntax, Conditions, Loops
 
Java essence part 1
Java essence part 1Java essence part 1
Java essence part 1
 
Back to the Future with TypeScript
Back to the Future with TypeScriptBack to the Future with TypeScript
Back to the Future with TypeScript
 
Rust Intro
Rust IntroRust Intro
Rust Intro
 
2013 lecture-02-syntax shortnewcut
2013 lecture-02-syntax shortnewcut2013 lecture-02-syntax shortnewcut
2013 lecture-02-syntax shortnewcut
 

Andere mochten auch

Introduction in Image Processing Matlab Toolbox
Introduction in Image Processing Matlab ToolboxIntroduction in Image Processing Matlab Toolbox
Introduction in Image Processing Matlab ToolboxShahriar Yazdipour
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great InfographicsSlideShare
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation OptimizationOneupweb
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShareKapost
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareEmpowered Presentations
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingContent Marketing Institute
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 

Andere mochten auch (11)

Introduction in Image Processing Matlab Toolbox
Introduction in Image Processing Matlab ToolboxIntroduction in Image Processing Matlab Toolbox
Introduction in Image Processing Matlab Toolbox
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Ähnlich wie F sharp _vs2010_beta2

Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharpDaniele Pozzobon
 
Testing for share
Testing for share Testing for share
Testing for share Rajeev Mehta
 
Intro f# functional_programming
Intro f# functional_programmingIntro f# functional_programming
Intro f# functional_programmingMauro Ghiani
 
C++ quik notes
C++ quik notesC++ quik notes
C++ quik notesargusacademy
 
Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )Ziyauddin Shaik
 
C# programming
C# programming C# programming
C# programming umesh patil
 
Introduction to FSharp
Introduction to FSharpIntroduction to FSharp
Introduction to FSharpValdis Iljuconoks
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Chris Adamson
 
Pydiomatic
PydiomaticPydiomatic
Pydiomaticrik0
 
Python idiomatico
Python idiomaticoPython idiomatico
Python idiomaticoPyCon Italia
 
ForLoopandUserDefinedFunctions.pptx
ForLoopandUserDefinedFunctions.pptxForLoopandUserDefinedFunctions.pptx
ForLoopandUserDefinedFunctions.pptxAaliyanShaikh
 
Functions_21_22.pdf
Functions_21_22.pdfFunctions_21_22.pdf
Functions_21_22.pdfpaijitk
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISPDevnology
 
#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting StartedHadziq Fabroyir
 
C++totural file
C++totural fileC++totural file
C++totural filehalaisumit
 
Tutconstructordes
TutconstructordesTutconstructordes
TutconstructordesNiti Arora
 

Ähnlich wie F sharp _vs2010_beta2 (20)

Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharp
 
Testing for share
Testing for share Testing for share
Testing for share
 
Intro f# functional_programming
Intro f# functional_programmingIntro f# functional_programming
Intro f# functional_programming
 
C++ quik notes
C++ quik notesC++ quik notes
C++ quik notes
 
Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )
 
C# programming
C# programming C# programming
C# programming
 
Introduction to FSharp
Introduction to FSharpIntroduction to FSharp
Introduction to FSharp
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
 
Pydiomatic
PydiomaticPydiomatic
Pydiomatic
 
Python idiomatico
Python idiomaticoPython idiomatico
Python idiomatico
 
ForLoopandUserDefinedFunctions.pptx
ForLoopandUserDefinedFunctions.pptxForLoopandUserDefinedFunctions.pptx
ForLoopandUserDefinedFunctions.pptx
 
Functions_21_22.pdf
Functions_21_22.pdfFunctions_21_22.pdf
Functions_21_22.pdf
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Functions.pdf
Functions.pdfFunctions.pdf
Functions.pdf
 
Functionscs12 ppt.pdf
Functionscs12 ppt.pdfFunctionscs12 ppt.pdf
Functionscs12 ppt.pdf
 
#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
C++totural file
C++totural fileC++totural file
C++totural file
 
Tutconstructordes
TutconstructordesTutconstructordes
Tutconstructordes
 
C++ tutorial
C++ tutorialC++ tutorial
C++ tutorial
 

KĂŒrzlich hochgeladen

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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 businesspanagenda
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 SavingEdi Saputra
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

KĂŒrzlich hochgeladen (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

F sharp _vs2010_beta2

  • 2. ï‚Ą F# is starting from a research project of Microsoft, created by Don Syme ï‚Ą F# is a functional programming language that runs on top of .NET ï‚Ą F# is now part of VS 2010 built in programming language ï‚Ą Also part of OCAML programming language family
  • 3. ï‚Ą There are many definitions about this, and there’s no simple standard definition ï‚Ą According to Erik Meijer and Brian Beckman of Microsoft, Functional Programming is programming with mathematical function, where function is a first class citizen of a program
  • 4. ï‚Ą A simple operation that returns a value, that can have a parameter or more than one parameters
  • 7. F# OOP (C#, VB, C++
) ï‚Ą Immutable by default ï‚Ą Mutable by default ï‚Ą Function is the same as ï‚Ą Function is treated as a data in a program, and can method that must reside in be written as a standalone a body of a class function ï‚Ą ‘Noisy’ syntax ï‚Ą Succinct syntax ï‚Ą Type inference is only ï‚Ą Type inference is available available since C# 3.0 and from the start VB 9.0, not in C++ and others
  • 8. Comparison of F# to others such as C#, VB, C++
  • 9. ï‚Ą Immutable by default ï‚Ą Mutable by default let y = x + 1 x = x +1 ï‚Ą Mutable is explicit ï‚Ą Immutable is explicit. For example, in C#: let mutable x = x + 1 readonly x = 0 ï‚Ą In VB: ReadOnly x As Integer
  • 10. ï‚Ą In F#, it can be ï‚Ą In C# and VB, it must standalone and simple be enclosed in a class/module let f x = x +2 class SimpleFunc { public static Int32 f(Int32 x) ï‚Ą This is why it is called { return x + 2; “succinct” } } ï‚Ą This is “noisy”
  • 11. ï‚Ą Already have at the first release ï‚Ą It is also a strong type language ï‚Ą Including built in support of Generic ï‚Ą The type inference is not just local type inference, but it then can be inferred based on the use of the parameters!
  • 12. Int32 let avalue =10 String let aName = ‘Hello’ let savingInterest = 0.2 Double
  • 13. ï‚Ą Type inference on functions when it’s used let f x = sqr x + 1 Infers integer .. return type from a whole becomes int number
 let sqr x = x * x Infers double from a double literal.. let f x = sqr x + 1.0
  • 14. Less noise syntax but it’s still strongly typed
  • 15. ï‚Ą Always begin with keyword “let” let avalue = 10 let aName = ‘Hello’ let savingInterest = 0.2
  • 16. ï‚Ą When there’s a need for explicit type system: let x:int = 0 let piConstant:float = 3.141 let Name:String = ‘Eriawan’
  • 17. ï‚Ą Always begin with let keyword let f x = x + 1 let sqr y = y * y let force x = x * gravity
  • 18. ï‚Ą Parameters are written in a nice separation “juxtaposition” syntax: a space let sqr x = x * x Function parameter let add a b = a + b
  • 20. ï‚Ą Multiple lines of code is using indentation: let rec fib x = if x < 2 then 1 else fib (x–1) + fib (x-2)
  • 21. ï‚Ą Comment is the same with VB and C# // some code let x = x + 2 // XML doc comment: /// <summary>A square function<summary> /// <param name=‚x‛>the value</param> let f x = x * x
  • 22. The object oriented and imperative are here in F#
  • 23. let f x = x *x let g(x) = x* x fun x -> x * x
  • 24. ï‚Ą Mutable is easy, by adding keyword “mutable” ï‚Ą Next operation of assignment must use “<-” to differentiate mutability. let mutable y = 10 y <- y + 1
  • 25. ï‚Ą Creating enum is also easy: type Suit = | Heart | Diamond | Spade | Club
  • 26. type Vector2D(dx:float, dy:float) = // The pre-computed length of the vector let length = sqrt(dx*dx + dy*dy) /// The displacement along the X-axis member v.DX = dx /// The displacement along the Y-axis member v.DY = dy /// The length of the vector member v.Length = length // Re-scale the vector by a constant member v.Scale(k) = Vector2D(k*dx, k*dy)
  • 27. ï‚Ą It’s easy! Just create type but with abstract keyword as modifier for all functions and other members: type IPeekPoke = abstract Peek: unit -> int abstract Poke: int -> unit
  • 28. Unit of measure in F# only!
  • 29. [<Measure>] type kg [<Measure>] type m [<Measure>] type s let gravityOnEarth = 9.81<m/s^2> let heightOfMyOfficeWindow = 3.5<m> let speedOfImpact = sqrt (2.0 * gravityOnEarth + heightOfMyOfficeWindow)
  • 30. Created by Eriawan Kusumawardhono, courtesy of RX Communica