1 / 26

Steven Anderson Tyler Stigliano

F#. Steven Anderson Tyler Stigliano. Overview . Introduction History Purpose Main Features Code Examples Final Remarks. Introduction. Targets .NET framework Intertwine with other .NET languages (C#, C++, VB) Variant of ML Largely compatible with OCaml syntax Functional Language

jennis
Download Presentation

Steven Anderson Tyler Stigliano

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. F# Steven Anderson Tyler Stigliano

  2. Overview • Introduction • History • Purpose • Main Features • Code Examples • Final Remarks

  3. Introduction • Targets .NET framework • Intertwine with other .NET languages (C#, C++, VB) • Variant of ML • Largely compatible with OCaml syntax • Functional Language • With object oriented and imperative disciplines

  4. History • Developed by Don Syme • Being developed at Microsoft Development Division • Releases • Version 1.0 – 2005 • Version 2.0 – 2010

  5. Purpose • To combine multiple programming paradigms into one • Functional Programming • Scientific modelers, mathematicians, financial institutions and more • Heavy number crunching • Get problems solved in a concise manner • Higher-Order functions • Type Inference

  6. Purpose cont. (Use Case #1) • Banking Firm in Europe • Uses mathematic models to manage investment portfolios • Built small units of functionality and combined them to create a model • Claims to have sped development by 50% • Quotes • “We could not have developed 200 models in two years without F# and Visual Studio” • “With a functional language like F#, we can create simple, compositional code, and so we naturally see a high degree of code reuse”

  7. Purpose cont. (Use Case #2) • Major energy company in UK • Application to balance national power generation schedule • Benefits • “Sweet spot” for algorithmically complex analysis of large data sets • Units of measurements • Used c++ to build interface; injected F# to do calculations • Code reduction • Parallelism

  8. Main Features • Characteristics • Strongly Typed • Immutable vs. Mutable • Eager evaluation • Parallelism • Encompasses: • Functional Programming • Imperative Programming • Object-Oriented Programming

  9. Main Features • Functional Programming • Functions as Values • Function Composition • Type Inference • Automatic Generalization • Pattern Matching • Lambda Expressions • Code Quotations

  10. Main Features • Imperative Programming • Control Flow • Arrays • Mutable Collections • Basic I/O • Exception Handling • Object-Oriented Programming • .NET Framework Object Model • Data Encapsulation • Operator Overloading • Type Extensions

  11. Code Examples Structure of F# program

  12. Code Examples Immutable Variables

  13. Code Examples Mutable Data

  14. Code Examples Function Declaration

  15. Code Examples Function Return Values

  16. Code Examples Recursion

  17. Code Examples Nested Functions

  18. Code Examples Pattern Matching

  19. Code Examples Tuples and Records

  20. Code Examples Tuples and Records cont.

  21. Code Examples Arrays

  22. Code Examples Loops

  23. Code Examples Additional Features • Higher-Order Function • Option Types • Lists & Sequences • Classes • Advanced Data Structures

  24. Final Remarks • Current Compilers • Sharp Develop (www.icasharpcode.net) • MS Visual Studio 2010 (www.msdn.com)

  25. References • http://en.wikibooks.org/wiki/F_Sharp_Programming/Basic_Concepts • http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/ • http://blogs.msdn.com/b/dsyme/archive/2011/01/12/f-for-energy-trading-and-energy-portfolio-optimization.aspx • http://msdn.microsoft.com/en-us/vstudio/hh388569.aspx

  26. F# Steven Anderson Tyler Stigliano

More Related