SlideShare a Scribd company logo
1 of 14
What The F#?

A beginners guide to F#ing around
             with F#
Who started F#ing?
• Functional programming has been around
  since 1956, starting with Information
  Processing Language, and popularized with
  Lisp
• F# started by Microsoft Research in 2005, as
  an implementation of OCaml
What the F# would I use it for?
• Used for scientific modelling, math, AI research,
  financial institutions, graphic design, CPU design,
  compiler programming, telecom engineers, etc.
• Targeted for heavy number crunching, abstract
  symbolic processing, or theorem proving
• That being said, could totally be used for CRUD,
  web dev, GUI, games, and general-purpose
  programming
What F#ing good is it?
• All those cool things in imperative
  programming, like generics, type inference, list
  comprehension, and anonymous types?

ALL CAME FROM FUNCTIONAL PROGRAMMING
F#ing Functions, how do they work?
• syntax:
  – let function-name parameter parameter =
    function-body
• let sum x y = x + y
• “sum” is a symbol that points to the function
  body
• Execution:
  – let result = sum 1 2 //result 1 + 2
What the F# is an Immutable Value?
• Every value in F# is immutable – it will not change
  after being declared
• This allows for values to be passed around
  without worrying if a function is going to change
  it
   – Data can be processed multi-threaded without having
     to worry about locks or race conditions
• Functions that return objects actually return
  entirely new objects cloned from what was
  passed in
How the F# does it know what type to
               use?
• Type Inference!
• let increment x = x + 1
   – you’re adding ints and returning an int
• let add x y = x + y
   – you’re adding two values of the same type and
     returning that type
F#ing Function Signatures
• let increment x = x + 1
• increment’s type is “int -> int”
   – We take an int, and return an int
• let sum x y = x + y
• sum‘s type is “int -> int -> int”
   – We take two ints, and return an int
      • Functions always return one value
I’m about to blow your F#ing mind
•   let sum x y = x + y
•   int -> int -> int
•   … is actually …
•   int -> (int -> int) :-o
•   EVERY FUNCTION ALWAYS TAKES ONE
    PARAMTER AND RETURNS ONE VALUE!
Hold on to your F#ing seat
• let sum x y = x + y
  – int -> (int -> int)
• Calling “sum 5” RETURNS A FUNCTION
  – of type “int -> int”
• let half-function = sum 5
• let result = half-function 10
• RESULT EQUALS 15!!!
F# beef stew, this is Currying
• The ability to take larger functions and use
  specific pieces of them
• let sum x y = x + y
• let increment = sum 1
• Now we can increment whatever the F# we
  want!
How to F# up an argument
• Because functions are values, they can be
  passed around like arguments
• let sumResult x y operation =
      (operation x) + (operation y)
• let square x = x * x
• let sumOfSquares = sumResult 2 3 square
  – sumOfSquares == 13!
F#ing complicated types
• let sumResult x y op = (op x) + (op y)
• Type: int -> int -> (int -> int) -> int
• But really…
  – int -> (int -> ((int -> int) -> int))
• let alwaysWorkWithOneAndTwo =
      sumResult 1 2
• Type: (int -> int) -> int
Anonymous F#ing
• let sumResult x y operation =
      (operation x) + (operation y)
• let sumOfDoubles =
      sumResult 1 2 (fun x -> x + x)
  – sumOfDoubles = 6!

More Related Content

What's hot

1.4 expression tree
1.4 expression tree  1.4 expression tree
1.4 expression tree Krish_ver2
 
Computer notes - Expression Tree
Computer notes - Expression TreeComputer notes - Expression Tree
Computer notes - Expression Treeecomputernotes
 
Top down and botttom up Parsing
Top down     and botttom up ParsingTop down     and botttom up Parsing
Top down and botttom up ParsingGerwin Ocsena
 
Pipeline oriented programming
Pipeline oriented programmingPipeline oriented programming
Pipeline oriented programmingScott Wlaschin
 

What's hot (7)

Polish
PolishPolish
Polish
 
1.4 expression tree
1.4 expression tree  1.4 expression tree
1.4 expression tree
 
Computer notes - Expression Tree
Computer notes - Expression TreeComputer notes - Expression Tree
Computer notes - Expression Tree
 
Top down and botttom up Parsing
Top down     and botttom up ParsingTop down     and botttom up Parsing
Top down and botttom up Parsing
 
Assignment6
Assignment6Assignment6
Assignment6
 
Pipeline oriented programming
Pipeline oriented programmingPipeline oriented programming
Pipeline oriented programming
 
Unit2 input output
Unit2 input outputUnit2 input output
Unit2 input output
 

Viewers also liked

Total Engagement
Total EngagementTotal Engagement
Total EngagementRTigger
 
Give your web apps some backbone
Give your web apps some backboneGive your web apps some backbone
Give your web apps some backboneRTigger
 
JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive ExtensionsRTigger
 
Single page apps and the web of tomorrow
Single page apps and the web of tomorrowSingle page apps and the web of tomorrow
Single page apps and the web of tomorrowRTigger
 

Viewers also liked (6)

Node.js
Node.jsNode.js
Node.js
 
Total Engagement
Total EngagementTotal Engagement
Total Engagement
 
Give your web apps some backbone
Give your web apps some backboneGive your web apps some backbone
Give your web apps some backbone
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive Extensions
 
Single page apps and the web of tomorrow
Single page apps and the web of tomorrowSingle page apps and the web of tomorrow
Single page apps and the web of tomorrow
 

Similar to What The F#

Functional Programming #FTW
Functional Programming #FTWFunctional Programming #FTW
Functional Programming #FTWAdriano Bonat
 
20170317 functional programming in julia
20170317 functional programming in julia20170317 functional programming in julia
20170317 functional programming in julia岳華 杜
 
The joy of functional programming
The joy of functional programmingThe joy of functional programming
The joy of functional programmingSteve Zhang
 
Python Learn Function with example programs
Python Learn Function with example programsPython Learn Function with example programs
Python Learn Function with example programsGeethaPanneer
 
Python programming
Python programmingPython programming
Python programmingsaroja20
 
Pythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxPythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxleavatin
 
Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Scott Wlaschin
 
Effective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili SaghafiEffective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili SaghafiProfessor Lili Saghafi
 
Functional Programming - Past, Present and Future
Functional Programming - Past, Present and FutureFunctional Programming - Past, Present and Future
Functional Programming - Past, Present and FuturePushkar Kulkarni
 
Functional Programming Past Present Future
Functional Programming Past Present FutureFunctional Programming Past Present Future
Functional Programming Past Present FutureIndicThreads
 
Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Omar Abdelhafith
 
The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||Ashwin Rao
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)Scott Wlaschin
 
F# for startups
F# for startupsF# for startups
F# for startupsjoelgrus
 
ch-3 funtions - 1 class 12.pdf
ch-3 funtions - 1 class 12.pdfch-3 funtions - 1 class 12.pdf
ch-3 funtions - 1 class 12.pdfzafar578075
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methodsPranavSB
 
Intro f# functional_programming
Intro f# functional_programmingIntro f# functional_programming
Intro f# functional_programmingMauro Ghiani
 
Functional Programming in Go
Functional Programming in GoFunctional Programming in Go
Functional Programming in GoAaron Schlesinger
 

Similar to What The F# (20)

Functional Programming #FTW
Functional Programming #FTWFunctional Programming #FTW
Functional Programming #FTW
 
20170317 functional programming in julia
20170317 functional programming in julia20170317 functional programming in julia
20170317 functional programming in julia
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
The joy of functional programming
The joy of functional programmingThe joy of functional programming
The joy of functional programming
 
Python Learn Function with example programs
Python Learn Function with example programsPython Learn Function with example programs
Python Learn Function with example programs
 
Python programming
Python programmingPython programming
Python programming
 
Pythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxPythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptx
 
Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)
 
Effective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili SaghafiEffective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
 
Functional Programming - Past, Present and Future
Functional Programming - Past, Present and FutureFunctional Programming - Past, Present and Future
Functional Programming - Past, Present and Future
 
Functional Programming Past Present Future
Functional Programming Past Present FutureFunctional Programming Past Present Future
Functional Programming Past Present Future
 
Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)
 
The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)
 
F# for startups
F# for startupsF# for startups
F# for startups
 
Clojure intro
Clojure introClojure intro
Clojure intro
 
ch-3 funtions - 1 class 12.pdf
ch-3 funtions - 1 class 12.pdfch-3 funtions - 1 class 12.pdf
ch-3 funtions - 1 class 12.pdf
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
 
Intro f# functional_programming
Intro f# functional_programmingIntro f# functional_programming
Intro f# functional_programming
 
Functional Programming in Go
Functional Programming in GoFunctional Programming in Go
Functional Programming in Go
 

More from RTigger

You Can't Buy Agile
You Can't Buy AgileYou Can't Buy Agile
You Can't Buy AgileRTigger
 
Caching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceCaching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceRTigger
 
Ready, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageReady, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageRTigger
 
Open source web services
Open source web servicesOpen source web services
Open source web servicesRTigger
 
How to hire a hacker
How to hire a hackerHow to hire a hacker
How to hire a hackerRTigger
 
Windows 8 programming with html and java script
Windows 8 programming with html and java scriptWindows 8 programming with html and java script
Windows 8 programming with html and java scriptRTigger
 
Open regina
Open reginaOpen regina
Open reginaRTigger
 
Async in .NET
Async in .NETAsync in .NET
Async in .NETRTigger
 
Hackers, hackathons, and you
Hackers, hackathons, and youHackers, hackathons, and you
Hackers, hackathons, and youRTigger
 
AJAX, JSON, and Client-Side Templates
AJAX, JSON, and Client-Side TemplatesAJAX, JSON, and Client-Side Templates
AJAX, JSON, and Client-Side TemplatesRTigger
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel ProcessingRTigger
 
Sql vs NoSQL
Sql vs NoSQLSql vs NoSQL
Sql vs NoSQLRTigger
 
Git’in Jiggy With Git
Git’in Jiggy With GitGit’in Jiggy With Git
Git’in Jiggy With GitRTigger
 
Web Services
Web ServicesWeb Services
Web ServicesRTigger
 

More from RTigger (14)

You Can't Buy Agile
You Can't Buy AgileYou Can't Buy Agile
You Can't Buy Agile
 
Caching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceCaching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' Performance
 
Ready, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageReady, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming language
 
Open source web services
Open source web servicesOpen source web services
Open source web services
 
How to hire a hacker
How to hire a hackerHow to hire a hacker
How to hire a hacker
 
Windows 8 programming with html and java script
Windows 8 programming with html and java scriptWindows 8 programming with html and java script
Windows 8 programming with html and java script
 
Open regina
Open reginaOpen regina
Open regina
 
Async in .NET
Async in .NETAsync in .NET
Async in .NET
 
Hackers, hackathons, and you
Hackers, hackathons, and youHackers, hackathons, and you
Hackers, hackathons, and you
 
AJAX, JSON, and Client-Side Templates
AJAX, JSON, and Client-Side TemplatesAJAX, JSON, and Client-Side Templates
AJAX, JSON, and Client-Side Templates
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel Processing
 
Sql vs NoSQL
Sql vs NoSQLSql vs NoSQL
Sql vs NoSQL
 
Git’in Jiggy With Git
Git’in Jiggy With GitGit’in Jiggy With Git
Git’in Jiggy With Git
 
Web Services
Web ServicesWeb Services
Web Services
 

Recently uploaded

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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 DiscoveryTrustArc
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
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 2024The Digital Insurer
 
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 challengesrafiqahmad00786416
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Recently uploaded (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+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...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

What The F#

  • 1. What The F#? A beginners guide to F#ing around with F#
  • 2. Who started F#ing? • Functional programming has been around since 1956, starting with Information Processing Language, and popularized with Lisp • F# started by Microsoft Research in 2005, as an implementation of OCaml
  • 3. What the F# would I use it for? • Used for scientific modelling, math, AI research, financial institutions, graphic design, CPU design, compiler programming, telecom engineers, etc. • Targeted for heavy number crunching, abstract symbolic processing, or theorem proving • That being said, could totally be used for CRUD, web dev, GUI, games, and general-purpose programming
  • 4. What F#ing good is it? • All those cool things in imperative programming, like generics, type inference, list comprehension, and anonymous types? ALL CAME FROM FUNCTIONAL PROGRAMMING
  • 5. F#ing Functions, how do they work? • syntax: – let function-name parameter parameter = function-body • let sum x y = x + y • “sum” is a symbol that points to the function body • Execution: – let result = sum 1 2 //result 1 + 2
  • 6. What the F# is an Immutable Value? • Every value in F# is immutable – it will not change after being declared • This allows for values to be passed around without worrying if a function is going to change it – Data can be processed multi-threaded without having to worry about locks or race conditions • Functions that return objects actually return entirely new objects cloned from what was passed in
  • 7. How the F# does it know what type to use? • Type Inference! • let increment x = x + 1 – you’re adding ints and returning an int • let add x y = x + y – you’re adding two values of the same type and returning that type
  • 8. F#ing Function Signatures • let increment x = x + 1 • increment’s type is “int -> int” – We take an int, and return an int • let sum x y = x + y • sum‘s type is “int -> int -> int” – We take two ints, and return an int • Functions always return one value
  • 9. I’m about to blow your F#ing mind • let sum x y = x + y • int -> int -> int • … is actually … • int -> (int -> int) :-o • EVERY FUNCTION ALWAYS TAKES ONE PARAMTER AND RETURNS ONE VALUE!
  • 10. Hold on to your F#ing seat • let sum x y = x + y – int -> (int -> int) • Calling “sum 5” RETURNS A FUNCTION – of type “int -> int” • let half-function = sum 5 • let result = half-function 10 • RESULT EQUALS 15!!!
  • 11. F# beef stew, this is Currying • The ability to take larger functions and use specific pieces of them • let sum x y = x + y • let increment = sum 1 • Now we can increment whatever the F# we want!
  • 12. How to F# up an argument • Because functions are values, they can be passed around like arguments • let sumResult x y operation = (operation x) + (operation y) • let square x = x * x • let sumOfSquares = sumResult 2 3 square – sumOfSquares == 13!
  • 13. F#ing complicated types • let sumResult x y op = (op x) + (op y) • Type: int -> int -> (int -> int) -> int • But really… – int -> (int -> ((int -> int) -> int)) • let alwaysWorkWithOneAndTwo = sumResult 1 2 • Type: (int -> int) -> int
  • 14. Anonymous F#ing • let sumResult x y operation = (operation x) + (operation y) • let sumOfDoubles = sumResult 1 2 (fun x -> x + x) – sumOfDoubles = 6!