26
F# Steven Anderson Tyler Stigliano

Steven Anderson Tyler Stigliano

  • Upload
    jennis

  • View
    44

  • Download
    0

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: Steven Anderson Tyler Stigliano

F#Steven Anderson

Tyler Stigliano

Page 2: Steven Anderson Tyler Stigliano

Introduction History Purpose Main Features Code Examples Final Remarks

Overview

Page 3: Steven Anderson Tyler Stigliano

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

Introduction

Page 4: Steven Anderson Tyler Stigliano

Developed by Don Syme

Being developed at Microsoft Development Division

Releases◦ Version 1.0 – 2005◦ Version 2.0 – 2010

History

Page 5: Steven Anderson Tyler Stigliano

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

Purpose

Page 6: Steven Anderson Tyler Stigliano

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”

Purpose cont. (Use Case #1)

Page 7: Steven Anderson Tyler Stigliano

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

Purpose cont. (Use Case #2)

Page 8: Steven Anderson Tyler Stigliano

Characteristics◦ Strongly Typed◦ Immutable vs. Mutable◦ Eager evaluation◦ Parallelism

Encompasses:◦ Functional Programming◦ Imperative Programming◦ Object-Oriented Programming

Main Features

Page 9: Steven Anderson Tyler Stigliano

Functional Programming◦ Functions as Values◦ Function Composition◦ Type Inference◦ Automatic Generalization◦ Pattern Matching◦ Lambda Expressions◦ Code Quotations

Main Features

Page 10: Steven Anderson Tyler Stigliano

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

Main Features

Page 11: Steven Anderson Tyler Stigliano

Structure of F# program

Code Examples

Page 12: Steven Anderson Tyler Stigliano

Immutable Variables

Code Examples

Page 13: Steven Anderson Tyler Stigliano

Mutable Data

Code Examples

Page 14: Steven Anderson Tyler Stigliano

Function Declaration

Code Examples

Page 15: Steven Anderson Tyler Stigliano

Function Return Values

Code Examples

Page 16: Steven Anderson Tyler Stigliano

Recursion

Code Examples

Page 17: Steven Anderson Tyler Stigliano

Nested Functions

Code Examples

Page 18: Steven Anderson Tyler Stigliano

Pattern Matching

Code Examples

Page 19: Steven Anderson Tyler Stigliano

Tuples and Records

Code Examples

Page 20: Steven Anderson Tyler Stigliano

Tuples and Records cont.

Code Examples

Page 21: Steven Anderson Tyler Stigliano

Arrays

Code Examples

Page 22: Steven Anderson Tyler Stigliano

Loops

Code Examples

Page 23: Steven Anderson Tyler Stigliano

Additional Features- Higher-Order Function- Option Types- Lists & Sequences- Classes- Advanced Data Structures

Code Examples

Page 24: Steven Anderson Tyler Stigliano

Current Compilers◦ Sharp Develop (www.icasharpcode.net)◦ MS Visual Studio 2010 (www.msdn.com)

Final Remarks

Page 26: Steven Anderson Tyler Stigliano

F#Steven Anderson

Tyler Stigliano