F# Eye 4 the C# GuyPhillip Trelford@ptrelfordhttp://trelford.com/blog
Thoughtworks Tech RadarMarch 2012 - Languages
“F# is excellent at concisely expressing               business and domain logic.”“Developers trying to achieve explicit b...
Visual F#
The F in F# is for FUN!
Halo 3 with F# Skills
XBLA: Path to Go – F# AI
Facebook: Monopoly
•   Statically Typed•   Functional•   Object Orientated•   Open Source•   .Net language•   In Visual StudioF#
• Idempotent Functions• Higher Order Functions• Pattern MatchingFunctional Programming
Functions - Excel
F# Map/Reduce                       C# Map/Reducelet map f xs = seq {                public static    for x in xs do      ...
F#                           C#match day with               switch (day) {| 0 -> "Sunday"                case 0: return "S...
DEMOS
F#                                   C#type Person(name:string,age:int) =   public class Person                           ...
C#                                                               F#public class VerySimpleStockTraderImpl : IAutomatedStoc...
F# NUnit                                    C# NUnitmodule MathTest =                           using NUnit.Framework;open...
BDD
Units of Measure
type formula = | Neg of formula | Exp of formula * formula | ArithmeticOp of    formula * arithmetic * formula | LogicalOp...
F# 3.0Type Providers
SUMMARY
F# Books
@rickasaurus     @tomaspetricek    @jonharropMeet the F#ersTwitter #fsharp
#chtd Quote from "future of .net"            Have a look at F# for two days            and you will find yourself two     ...
Links                    Connect• http://fsharp.org      • @ptrelford• http://fssnip.net      • phil@trelford.com• http://...
Upcoming SlideShare
Loading in …5
×

F# Eye For The C# Guy - Seattle 2013

1,322 views

Published on

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • I Got The Full File, I Just Wanna Share to You Guyszz.. It's Working You Can The Download The Full File + Instructions Here : http://gg.gg/setupexe
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total views
1,322
On SlideShare
0
From Embeds
0
Number of Embeds
167
Actions
Shares
0
Downloads
11
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide
  • MonoDevelop,Emacs & VIM
  • F# Eye For The C# Guy - Seattle 2013

    1. 1. F# Eye 4 the C# GuyPhillip Trelford@ptrelfordhttp://trelford.com/blog
    2. 2. Thoughtworks Tech RadarMarch 2012 - Languages
    3. 3. “F# is excellent at concisely expressing business and domain logic.”“Developers trying to achieve explicit business logic within an application may opt to express their domain in F# with the majority of plumbing code in C#.”Thoughtworks Tech RadarMarch 2012 - Quotes
    4. 4. Visual F#
    5. 5. The F in F# is for FUN!
    6. 6. Halo 3 with F# Skills
    7. 7. XBLA: Path to Go – F# AI
    8. 8. Facebook: Monopoly
    9. 9. • Statically Typed• Functional• Object Orientated• Open Source• .Net language• In Visual StudioF#
    10. 10. • Idempotent Functions• Higher Order Functions• Pattern MatchingFunctional Programming
    11. 11. Functions - Excel
    12. 12. F# Map/Reduce C# Map/Reducelet map f xs = seq { public static for x in xs do IEnumerable<R> Map<T, R> (this IEnumerable<T> xs, yield f x Func<T, R> f) } { foreach (var x in xs)let reduce f init items = yield return f(x); let mutable current = init } for item in items do public static R current <- f current item Reduce<T, R> current (this IEnumerable<T> xs, R init, Func<R, T, R> f) { var current = init; foreach (var x in xs) current = f(current, x); return current; }Higher Order Functions
    13. 13. F# C#match day with switch (day) {| 0 -> "Sunday" case 0: return "Sunday"; case 1: return "Monday";| 1 -> "Monday" case 2: return "Tuesday";| 2 -> "Tuesday" case 3: return "Wednesday";| 3 -> "Wednesday" case 4: return "Thursday";| 4 -> "Thursday" case 5: return "Friday";| 5 -> "Friday" case 6: return "Saturday"; default:| 6 -> "Saturday" throw new| _ –> ArgumentException("day"); invalidArg "Invalid day" }Pattern Matching
    14. 14. DEMOS
    15. 15. F# C#type Person(name:string,age:int) = public class Person { public Person(string name, int age) /// Full name { member person.Name = name _name = name; _age = age; /// Age in years } member person.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> public int Age { get { return _age; } } }Light Syntax: POCOs
    16. 16. C# F#public class VerySimpleStockTraderImpl : IAutomatedStockTrader type VerySimpleStockTraderImpl{ (analysisService:IStockAnalysisService, private readonly IStockAnalysisService analysisService; private readonly IOnlineBrokerageService brokerageService; brokerageService:IOnlineBrokerageService) = member this.ExecuteTrades() = () // ... public VerySimpleStockTraderImpl( IStockAnalysisService analysisService, IOnlineBrokerageService brokerageService) { this.analysisService = analysisService; this.brokerageService = brokerageService; } public void ExecuteTrades() { // ... }}Light Syntax: DI
    17. 17. F# NUnit C# NUnitmodule MathTest = using NUnit.Framework;open NUnit.Framework [TestFixture] public class MathTest {let [<Test>] ``2 + 2 should equal 4``() = [Test] Assert.AreEqual(2 + 2, 4) public void TwoPlusTwoShouldEqualFour() { Assert.AreEqual(2 + 2, 4); } }Unit Testing
    18. 18. BDD
    19. 19. Units of Measure
    20. 20. 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 listUnits in Cells
    21. 21. F# 3.0Type Providers
    22. 22. SUMMARY
    23. 23. F# Books
    24. 24. @rickasaurus @tomaspetricek @jonharropMeet the F#ersTwitter #fsharp
    25. 25. #chtd Quote from "future of .net" Have a look at F# for two days and you will find yourself two years ahead of your peer .net devs. #fsharp@jbandi
    26. 26. Links Connect• http://fsharp.org • @ptrelford• http://fssnip.net • phil@trelford.com• http://tryfsharp.org • http://trelford.com/blogQ&A

    ×