SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Functional Programming
          - Introducing F#



                     06/15/2012
Example
 Give me a list of numbers from 1 to 100.




    Tell me how ?             Tell me what ?
What?
Functional programming is a programming paradigm
that treats computation as the evaluation of
mathematical functions and avoids state and mutable
data.


                      y = f (x)
A function is a transformation. It transforms one or more inputs into exactly
one output.
Why?
 Succinct & simpler programs
   Small code base, low dev/maintenance cost.


 A number of powerful new ways to structure and
 reason about programs.
   Immutability
   High order function
   Pattern Matching
   
How?

 Immutability
 Type Inference
 Recursion
 High Order Functions
 Partial Application
 Pattern Matching
 Unit of Measure
Immutability
By default, values are immutable. Use keyword
mutable to mark it as mutable.
Type Inference
 F# can deduce data types automatically.
 Type annotation is necessary in certain case.
Recursion
‱ Functional programming prefers recursion to
  imperative for-each loops.

‱ Prefer tail recursion to avoid stack overflow
High order Function
 Functions in F#
High order Function
 Functions as First Class Member
 Functions that accept a function as a parameter or
 returns a function
High Order Function

 Map
 Fold
 Zip
 Filter
 Pipeline
 Function Composition
 Partial Application
Pattern Match
 Compare data with a logical structure
 Decompose data into its constituent parts
 Extract information from constructs in various
 ways
Unit of Measure
 Floating point and signed integer values in F# can
  have associated units of measure.
 Compile time checking.
Functional Programming in Real World
 Erlang developed in Ericsson widely used in T-
  Mobile, Facebook....
 Industry
   Communication
   Finance industry
   Scientific computation
   AI

 Languages support FP
   Haskell
   Scala
   Python
   Clojure
   

Resources
 The F# Survival Guide
 Functional Programming for the Real World
Functional programming   f#

Weitere Àhnliche Inhalte

Was ist angesagt?

Linear programming optimization in r
Linear programming optimization in r Linear programming optimization in r
Linear programming optimization in r
Ashwini Mathur
 

Was ist angesagt? (14)

Computer Organization and Architecture Overview
Computer Organization and Architecture OverviewComputer Organization and Architecture Overview
Computer Organization and Architecture Overview
 
Interpretable ML
Interpretable MLInterpretable ML
Interpretable ML
 
Feature Engineering & Selection
Feature Engineering & SelectionFeature Engineering & Selection
Feature Engineering & Selection
 
Math Editing and display using Microsoft Office 2007 System
Math Editing and display using Microsoft Office 2007 System Math Editing and display using Microsoft Office 2007 System
Math Editing and display using Microsoft Office 2007 System
 
Excel
ExcelExcel
Excel
 
Csc240 -lecture_5
Csc240  -lecture_5Csc240  -lecture_5
Csc240 -lecture_5
 
Math Functions in C Scanf Printf
Math Functions in C Scanf PrintfMath Functions in C Scanf Printf
Math Functions in C Scanf Printf
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Templates c++ - prashant odhavani - 160920107003
Templates   c++ - prashant odhavani - 160920107003Templates   c++ - prashant odhavani - 160920107003
Templates c++ - prashant odhavani - 160920107003
 
hjlhjljkl
hjlhjljklhjlhjljkl
hjlhjljkl
 
System approach in civil engg slideshare.vvs
System approach in civil engg slideshare.vvsSystem approach in civil engg slideshare.vvs
System approach in civil engg slideshare.vvs
 
Basic Algorithm @PPSC(1)
Basic Algorithm @PPSC(1)Basic Algorithm @PPSC(1)
Basic Algorithm @PPSC(1)
 
Linear programming optimization in r
Linear programming optimization in r Linear programming optimization in r
Linear programming optimization in r
 
Introduction to-programming
Introduction to-programmingIntroduction to-programming
Introduction to-programming
 

Ähnlich wie Functional programming f#

Functional Paradigm.pptx
Functional Paradigm.pptxFunctional Paradigm.pptx
Functional Paradigm.pptx
FurretMaster
 
Succeeding with Functional-first Programming in Enterprise
Succeeding with Functional-first Programming in EnterpriseSucceeding with Functional-first Programming in Enterprise
Succeeding with Functional-first Programming in Enterprise
dsyme
 
Functional Programming in Ruby
Functional Programming in RubyFunctional Programming in Ruby
Functional Programming in Ruby
Alex Teut
 

Ähnlich wie Functional programming f# (20)

Functional Paradigm.pptx
Functional Paradigm.pptxFunctional Paradigm.pptx
Functional Paradigm.pptx
 
Prgramming paradigms
Prgramming paradigmsPrgramming paradigms
Prgramming paradigms
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
 
Functional Ruby
Functional RubyFunctional Ruby
Functional Ruby
 
Succeeding with Functional-first Programming in Enterprise
Succeeding with Functional-first Programming in EnterpriseSucceeding with Functional-first Programming in Enterprise
Succeeding with Functional-first Programming in Enterprise
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Programming in c++ ppt
Programming in c++ pptProgramming in c++ ppt
Programming in c++ ppt
 
Programming in c++ ppt
Programming in c++ pptProgramming in c++ ppt
Programming in c++ ppt
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Introduction to functional programming
Introduction to functional programmingIntroduction to functional programming
Introduction to functional programming
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
arrays.ppt
arrays.pptarrays.ppt
arrays.ppt
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Functional Programming in Ruby
Functional Programming in RubyFunctional Programming in Ruby
Functional Programming in Ruby
 
Functions in c++, presentation, short and sweet presentation, and details of ...
Functions in c++, presentation, short and sweet presentation, and details of ...Functions in c++, presentation, short and sweet presentation, and details of ...
Functions in c++, presentation, short and sweet presentation, and details of ...
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
 
Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languages
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
 

KĂŒrzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

KĂŒrzlich hochgeladen (20)

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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

Functional programming f#

  • 1. Functional Programming - Introducing F# 06/15/2012
  • 2. Example  Give me a list of numbers from 1 to 100. Tell me how ? Tell me what ?
  • 3. What? Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. y = f (x) A function is a transformation. It transforms one or more inputs into exactly one output.
  • 4. Why?  Succinct & simpler programs  Small code base, low dev/maintenance cost.  A number of powerful new ways to structure and reason about programs.  Immutability  High order function  Pattern Matching  
  • 5. How?  Immutability  Type Inference  Recursion  High Order Functions  Partial Application  Pattern Matching  Unit of Measure
  • 6. Immutability By default, values are immutable. Use keyword mutable to mark it as mutable.
  • 7. Type Inference  F# can deduce data types automatically.  Type annotation is necessary in certain case.
  • 8. Recursion ‱ Functional programming prefers recursion to imperative for-each loops. ‱ Prefer tail recursion to avoid stack overflow
  • 9. High order Function  Functions in F#
  • 10. High order Function  Functions as First Class Member  Functions that accept a function as a parameter or returns a function
  • 11. High Order Function  Map  Fold  Zip  Filter  Pipeline  Function Composition  Partial Application
  • 12. Pattern Match  Compare data with a logical structure  Decompose data into its constituent parts  Extract information from constructs in various ways
  • 13. Unit of Measure  Floating point and signed integer values in F# can have associated units of measure.  Compile time checking.
  • 14. Functional Programming in Real World  Erlang developed in Ericsson widely used in T- Mobile, Facebook....  Industry  Communication  Finance industry  Scientific computation  AI  Languages support FP  Haskell  Scala  Python  Clojure  

  • 15. Resources  The F# Survival Guide  Functional Programming for the Real World