SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Phil Trelford, @ptrelford 
#FuncBY Minsk, 2014
 Statically Typed 
 Functional First 
 Object Orientated 
 Open Source 
 .Net language 
 In Visual Studio 
& Xamarin Studio
Kaggle 
The fact that F# targets the 
CLR was also critical 
we have a large existing code 
base in C#, 
getting started with F# was 
an easy decision.
The F# code is 
consistently shorter, 
easier to read, 
easier to refactor and 
contains far fewer bugs. 
…we’ve become 
more productive.
Phil Trelford, @ptrelford 
#FuncBY Minsk, 2014
F# 
type Person(name:string,age:int) = 
/// Full name 
member person.Name = name 
/// Age in years 
member person.Age = age 
C# 
public class Person 
{ 
public Person(string name, int age) 
{ 
_name = name; 
_age = age; 
} 
private readonly string _name; 
private readonly int _age; 
/// <summary> 
/// Full name 
/// </summary> 
public string Name 
{ 
get { return _name; } 
} 
/// <summary> 
/// Age in years 
/// </summary>
F# 
type VerySimpleStockTrader 
(analysisService:IStockAnalysisService, 
brokerageService:IOnlineBrokerageService) = 
member this.ExecuteTrades() = 
() // ... 
C# 
public class VerySimpleStockTrader 
{ 
private readonly 
IStockAnalysisService analysisService; 
private readonly 
IOnlineBrokerageService brokerageService; 
public VerySimpleStockTrader( 
IStockAnalysisService analysisService, 
IOnlineBrokerageService brokerageService) 
{ 
this.analysisService = analysisService; 
this.brokerageService = brokerageService; 
} 
public void ExecuteTrades() 
{ 
// ... 
} 
}
F# NUnit 
module MathTest = 
open NUnit.Framework 
let [<Test>] ``2 + 2 should equal 4``() = 
Assert.AreEqual(2 + 2, 4) 
C# NUnit 
using NUnit.Framework; 
[TestFixture] 
public class MathTest 
{ 
[Test] 
public void TwoPlusTwoShouldEqualFour() 
{ 
Assert.AreEqual(2 + 2, 4); 
} 
}
F# Foq 
let ``order sends mail if unfilled``() = 
// setup data 
let order = Order("TALISKER", 51) 
let mailer = mock() 
order.SetMailer(mailer) 
// exercise 
order.Fill(mock()) 
// verify 
verify <@ mailer.Send(any()) @> once 
C# Moq 
public void OrderSendsMailIfUnfilled() 
{ 
// setup data 
var order = new Order("TALISKER", 51); 
var mailer = new Mock<MailService>(); 
order.SetMailer(mailer.Object); 
// exercise 
order.Fill(Mock.Of<Warehouse>()); 
// verify 
mailer.Verify(mock => 
mock.Send(It.IsAny<string>()), 
Times.Once()); 
}
type formula = 
| Neg of formula 
| Exp of formula * formula 
| ArithmeticOp of 
formula * arithmetic * formula 
| LogicalOp of 
formula * logical * formula 
| Num of UnitValue 
| Ref of int * int 
| Range of int * int * int * int 
| Fun of string * formula list
open FSharp.Data 
type Simple = JsonProvider<""" { "name":"John", "age":94 } """> 
let simple = Simple.Parse(""" { "name":"Tomas", "age":4 } """) 
Simple.Age
Phil Trelford, @ptrelford 
#FuncBY Minsk, 2014
software stacks 
trainings teaching F# user groups snippets 
mac and linux cross-platform books and tutorials 
F# Software Foundation 
F# community open-source MonoDevelop 
http://www.fsharp.org 
contributions research support 
consultancy mailing list
//--------------------------------------------------------------- 
// About Let 
// 
// The let keyword is one of the most fundamental parts of F#. 
// You'll use it in almost every line of F# code you write, so 
// let's get to know it well! (no pun intended) 
//--------------------------------------------------------------- 
[<Koan(Sort = 2)>] 
module ``about let`` = 
[<Koan>] 
let LetBindsANameToAValue() = 
let x = 50 
AssertEquality x __
Phil Trelford, @ptrelford 
#FuncBY Minsk, 2014

Weitere ähnliche Inhalte

Was ist angesagt?

Pipeline oriented programming
Pipeline oriented programmingPipeline oriented programming
Pipeline oriented programmingScott Wlaschin
 
F# Eye For The C# Guy - Seattle 2013
F# Eye For The C# Guy - Seattle 2013F# Eye For The C# Guy - Seattle 2013
F# Eye For The C# Guy - Seattle 2013Phillip Trelford
 
Python Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modulesPython Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modulesP3 InfoTech Solutions Pvt. Ltd.
 
FParsec Hands On - F#unctional Londoners 2014
FParsec Hands On -  F#unctional Londoners 2014FParsec Hands On -  F#unctional Londoners 2014
FParsec Hands On - F#unctional Londoners 2014Phillip Trelford
 
Write Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 HoursWrite Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 HoursPhillip Trelford
 
python Function
python Function python Function
python Function Ronak Rathi
 
C++ Preprocessor Directives
C++ Preprocessor DirectivesC++ Preprocessor Directives
C++ Preprocessor DirectivesWasif Altaf
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)Ritika Sharma
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
Python programing
Python programingPython programing
Python programinghamzagame
 
Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)Rick Copeland
 
Polymorphism
PolymorphismPolymorphism
PolymorphismAmir Ali
 
Interpreter Design Pattern in Javascript
Interpreter Design Pattern in JavascriptInterpreter Design Pattern in Javascript
Interpreter Design Pattern in JavascriptDmytro Verbovyi
 

Was ist angesagt? (20)

Pipeline oriented programming
Pipeline oriented programmingPipeline oriented programming
Pipeline oriented programming
 
F# Eye For The C# Guy - Seattle 2013
F# Eye For The C# Guy - Seattle 2013F# Eye For The C# Guy - Seattle 2013
F# Eye For The C# Guy - Seattle 2013
 
Python Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modulesPython Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modules
 
Python master class 2
Python master class 2Python master class 2
Python master class 2
 
FParsec Hands On - F#unctional Londoners 2014
FParsec Hands On -  F#unctional Londoners 2014FParsec Hands On -  F#unctional Londoners 2014
FParsec Hands On - F#unctional Londoners 2014
 
Write Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 HoursWrite Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 Hours
 
python Function
python Function python Function
python Function
 
Lecture 14 - Scope Rules
Lecture 14 - Scope RulesLecture 14 - Scope Rules
Lecture 14 - Scope Rules
 
C++ Preprocessor Directives
C++ Preprocessor DirectivesC++ Preprocessor Directives
C++ Preprocessor Directives
 
3 Function Overloading
3 Function Overloading3 Function Overloading
3 Function Overloading
 
Lecture 13 - Storage Classes
Lecture 13 - Storage ClassesLecture 13 - Storage Classes
Lecture 13 - Storage Classes
 
Run rmi
Run rmiRun rmi
Run rmi
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Python basics
Python basicsPython basics
Python basics
 
Introduction to Perl Programming
Introduction to Perl ProgrammingIntroduction to Perl Programming
Introduction to Perl Programming
 
Python programing
Python programingPython programing
Python programing
 
Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Interpreter Design Pattern in Javascript
Interpreter Design Pattern in JavascriptInterpreter Design Pattern in Javascript
Interpreter Design Pattern in Javascript
 

Andere mochten auch

Максим Харченко. Erlang lincx
Максим Харченко. Erlang lincxМаксим Харченко. Erlang lincx
Максим Харченко. Erlang lincxAlina Dolgikh
 
Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.Alina Dolgikh
 
Максим Лапшин. Erlang production
Максим Лапшин. Erlang productionМаксим Лапшин. Erlang production
Максим Лапшин. Erlang productionAlina Dolgikh
 
Tame cloud complexity with F#-powered DSLs
Tame cloud complexity with F#-powered DSLsTame cloud complexity with F#-powered DSLs
Tame cloud complexity with F#-powered DSLsYan Cui
 

Andere mochten auch (6)

Eugene Burmako
Eugene BurmakoEugene Burmako
Eugene Burmako
 
Максим Харченко. Erlang lincx
Максим Харченко. Erlang lincxМаксим Харченко. Erlang lincx
Максим Харченко. Erlang lincx
 
Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.
 
Максим Лапшин. Erlang production
Максим Лапшин. Erlang productionМаксим Лапшин. Erlang production
Максим Лапшин. Erlang production
 
Heather Miller
Heather MillerHeather Miller
Heather Miller
 
Tame cloud complexity with F#-powered DSLs
Tame cloud complexity with F#-powered DSLsTame cloud complexity with F#-powered DSLs
Tame cloud complexity with F#-powered DSLs
 

Ähnlich wie F# Eye For The C# Guy - f(by) Minsk 2014

F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015Phillip Trelford
 
F# for C# devs - Leeds Sharp 2015
F# for C# devs -  Leeds Sharp 2015F# for C# devs -  Leeds Sharp 2015
F# for C# devs - Leeds Sharp 2015Phillip Trelford
 
Introduction to Functional Programming
Introduction to Functional ProgrammingIntroduction to Functional Programming
Introduction to Functional ProgrammingHoàng Lâm Huỳnh
 
Mercury: A Functional Review
Mercury: A Functional ReviewMercury: A Functional Review
Mercury: A Functional ReviewMark Cheeseman
 
F# eye for the C# guy - NorDev Norwich
F# eye for the C# guy - NorDev NorwichF# eye for the C# guy - NorDev Norwich
F# eye for the C# guy - NorDev NorwichPhillip Trelford
 
ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015qmmr
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionSchalk Cronjé
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionHans Höchtl
 
C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607Kevin Hazzard
 
Learning go for perl programmers
Learning go for perl programmersLearning go for perl programmers
Learning go for perl programmersFred Moyer
 
Generating characterization tests for legacy code
Generating characterization tests for legacy codeGenerating characterization tests for legacy code
Generating characterization tests for legacy codeJonas Follesø
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
 

Ähnlich wie F# Eye For The C# Guy - f(by) Minsk 2014 (20)

F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015
 
F# for C# devs - SDD 2015
F# for C# devs - SDD 2015F# for C# devs - SDD 2015
F# for C# devs - SDD 2015
 
F# for C# devs - Leeds Sharp 2015
F# for C# devs -  Leeds Sharp 2015F# for C# devs -  Leeds Sharp 2015
F# for C# devs - Leeds Sharp 2015
 
Introduction to Functional Programming
Introduction to Functional ProgrammingIntroduction to Functional Programming
Introduction to Functional Programming
 
FSharp in the enterprise
FSharp in the enterpriseFSharp in the enterprise
FSharp in the enterprise
 
Mercury: A Functional Review
Mercury: A Functional ReviewMercury: A Functional Review
Mercury: A Functional Review
 
F# eye for the C# guy - NorDev Norwich
F# eye for the C# guy - NorDev NorwichF# eye for the C# guy - NorDev Norwich
F# eye for the C# guy - NorDev Norwich
 
ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
F# Eye 4 the C# Guy
F# Eye 4 the C# GuyF# Eye 4 the C# Guy
F# Eye 4 the C# Guy
 
Kpi driven-java-development-fn conf
Kpi driven-java-development-fn confKpi driven-java-development-fn conf
Kpi driven-java-development-fn conf
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607
 
Learning go for perl programmers
Learning go for perl programmersLearning go for perl programmers
Learning go for perl programmers
 
C Programming Project
C Programming ProjectC Programming Project
C Programming Project
 
Generating characterization tests for legacy code
Generating characterization tests for legacy codeGenerating characterization tests for legacy code
Generating characterization tests for legacy code
 
Clean code
Clean codeClean code
Clean code
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to Space
 
File Organization & processing Mid term summer 2014 - modelanswer
File Organization & processing Mid term summer 2014 - modelanswerFile Organization & processing Mid term summer 2014 - modelanswer
File Organization & processing Mid term summer 2014 - modelanswer
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Kürzlich hochgeladen (20)

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

F# Eye For The C# Guy - f(by) Minsk 2014

  • 1. Phil Trelford, @ptrelford #FuncBY Minsk, 2014
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.  Statically Typed  Functional First  Object Orientated  Open Source  .Net language  In Visual Studio & Xamarin Studio
  • 8. Kaggle The fact that F# targets the CLR was also critical we have a large existing code base in C#, getting started with F# was an easy decision.
  • 9. The F# code is consistently shorter, easier to read, easier to refactor and contains far fewer bugs. …we’ve become more productive.
  • 10. Phil Trelford, @ptrelford #FuncBY Minsk, 2014
  • 11. F# type Person(name:string,age:int) = /// Full name member person.Name = name /// Age in years member person.Age = age C# public class Person { public Person(string name, int age) { _name = name; _age = age; } private readonly string _name; private readonly int _age; /// <summary> /// Full name /// </summary> public string Name { get { return _name; } } /// <summary> /// Age in years /// </summary>
  • 12. F# type VerySimpleStockTrader (analysisService:IStockAnalysisService, brokerageService:IOnlineBrokerageService) = member this.ExecuteTrades() = () // ... C# public class VerySimpleStockTrader { private readonly IStockAnalysisService analysisService; private readonly IOnlineBrokerageService brokerageService; public VerySimpleStockTrader( IStockAnalysisService analysisService, IOnlineBrokerageService brokerageService) { this.analysisService = analysisService; this.brokerageService = brokerageService; } public void ExecuteTrades() { // ... } }
  • 13. F# NUnit module MathTest = open NUnit.Framework let [<Test>] ``2 + 2 should equal 4``() = Assert.AreEqual(2 + 2, 4) C# NUnit using NUnit.Framework; [TestFixture] public class MathTest { [Test] public void TwoPlusTwoShouldEqualFour() { Assert.AreEqual(2 + 2, 4); } }
  • 14. F# Foq let ``order sends mail if unfilled``() = // setup data let order = Order("TALISKER", 51) let mailer = mock() order.SetMailer(mailer) // exercise order.Fill(mock()) // verify verify <@ mailer.Send(any()) @> once C# Moq public void OrderSendsMailIfUnfilled() { // setup data var order = new Order("TALISKER", 51); var mailer = new Mock<MailService>(); order.SetMailer(mailer.Object); // exercise order.Fill(Mock.Of<Warehouse>()); // verify mailer.Verify(mock => mock.Send(It.IsAny<string>()), Times.Once()); }
  • 15.
  • 16. type formula = | Neg of formula | Exp of formula * formula | ArithmeticOp of formula * arithmetic * formula | LogicalOp of formula * logical * formula | Num of UnitValue | Ref of int * int | Range of int * int * int * int | Fun of string * formula list
  • 17. open FSharp.Data type Simple = JsonProvider<""" { "name":"John", "age":94 } """> let simple = Simple.Parse(""" { "name":"Tomas", "age":4 } """) Simple.Age
  • 18.
  • 19. Phil Trelford, @ptrelford #FuncBY Minsk, 2014
  • 20. software stacks trainings teaching F# user groups snippets mac and linux cross-platform books and tutorials F# Software Foundation F# community open-source MonoDevelop http://www.fsharp.org contributions research support consultancy mailing list
  • 21. //--------------------------------------------------------------- // About Let // // The let keyword is one of the most fundamental parts of F#. // You'll use it in almost every line of F# code you write, so // let's get to know it well! (no pun intended) //--------------------------------------------------------------- [<Koan(Sort = 2)>] module ``about let`` = [<Koan>] let LetBindsANameToAValue() = let x = 50 AssertEquality x __
  • 22.
  • 23.
  • 24.
  • 25.
  • 26. Phil Trelford, @ptrelford #FuncBY Minsk, 2014

Hinweis der Redaktion

  1. MonoDevelop, Emacs & VIM
  2. http://fsharp.org/testimonials/#kaggle-1 Don’t throw out the baby with the bath water