SlideShare une entreprise Scribd logo
1  sur  21
Functional programming and F# Sanko.net meeting 8.6.2011
Agenda Functional programming from c# perspective, Linq principles Functional programming in general F# and C# interoperability F# examples: ’basic’ stuff F# vs. C#
Agenda Functional programming from c# perspective, Linq principles Functional programming in general F# and C# interoperability F# examples: ’basic’ stuff F# vs. C#  Eh? There’s a bug in the Agenda!!! Wrong order and names missing!
This happens, when you Powerpoint without test harness!  Lets kick the PowerPoint and.... Correct the agenda using....
F#? This happens, when you Powerpoint without test harness!  Lets kick the PowerPoint and.... Correct the agenda using....
F#? This happens, when you Powerpoint without test harness!  Lets kick the PowerPoint and.... Correct the agenda using.... Java guy? Great!
Demo....  Source available @ github:  https://github.com/ramik/Demo/blob/master/FunctionalTutorial/CSharpExamples/PresisDemo/SlideDemo.fs And if you don’t have internet access, snapshotted source just for you module SlideDemo open System; type PresentationKeeper(name: string, employer : string) =          member lollis.name = name         member fuulis.employer = employer         override this.ToString() = name + ", " + employer let Rami = PresentationKeeper("Rami Karjalainen", "Reaktor") let Tuomas = PresentationKeeper("Tuomas Hietanen", "Basware") let topics = [ (2, "Functional programming from c# perspective, Linq principles", Tuomas);                (1, "Functional programming in general", Rami);                (3, "F# examples: ’basic’ stuff", Rami);                (4, "F# and C# interoperability", Rami);                (5, "F# vs. C#", Tuomas) ] let formatTopic topic keeper = String.Format ("{0} ({1})", topic, keeper.ToString()) let pimpTheList = topics |> Seq.sortBy (fun (prio,_,_) -> prio)                           |> Seq.map (fun (_, a, b) -> a,b)                          |> Seq.map (fun x -> (formatTopic (fst x) (snd x))) let printPimped x = x |> Seq.iter (fun c -> printfn "%s" c)
Why F#?
Why F#? Well, simply because its fun!
Why F#? Well, simply because its fun! (fun is reserved keyword, for      expression)!
F# has / is: Succint Closures Functional Generics Discrimated unions .net official language (v4  ) Pattern matching Tail recursion optimization   Tuples Immutable by default asynchronous workflows Very expressive Interoperable Type inference Classes Infinite lists etc. (laziness)  Strongly typed Hybrid (oo, imperative) Lambda expressions (anon func) REPL (interactive) OCaml
F# has / is: But for now, lets  focus on this! Functional
Well, what is functional programming? ,[object Object]
Functions as first class ”citizens”
Recursion
No mutable state Many other concepts apply, but these are ones  to focus in this presentation
Immutability: Object cannot be changed after creation In C#, mark fields as readonly No mutable state  no local variables
Functions as first class citizens: Functions can be passed as normal parameters  Composition Higher order functions ,[object Object],and/or ,[object Object],[object Object]
Recursion: In functional programming, no iteration or ”looping” Recursion is very important concept
Recursion: In functional programming, no iteration or ”looping” Recursion is very important concept ,[object Object],as without it ....
Recursion: In functional programming, no iteration or ”looping” Recursion is very important concept ,[object Object],as without it ....

Contenu connexe

Tendances

Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Tomas Petricek
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.Nicholas Pringle
 
F# Intro for Scala Developers
F# Intro for Scala DevelopersF# Intro for Scala Developers
F# Intro for Scala Developersfsug
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C ProgrammingAniket Patne
 
Python Programming - I. Introduction
Python Programming - I. IntroductionPython Programming - I. Introduction
Python Programming - I. IntroductionRanel Padon
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Skills Matter
 
Python Basics
Python BasicsPython Basics
Python BasicsPooja B S
 
FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015Phillip Trelford
 
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Skills Matter
 
Presentation on C++ programming
Presentation on C++ programming Presentation on C++ programming
Presentation on C++ programming AditiTibile
 
C programming Ms. Pranoti Doke
C programming Ms. Pranoti DokeC programming Ms. Pranoti Doke
C programming Ms. Pranoti DokePranoti Doke
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1Devashish Kumar
 
The GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation WorldThe GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation WorldRadina Matic
 
File handling With Solve Programs
File handling With Solve ProgramsFile handling With Solve Programs
File handling With Solve ProgramsRohan Gajre
 

Tendances (20)

Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.
 
F# Intro for Scala Developers
F# Intro for Scala DevelopersF# Intro for Scala Developers
F# Intro for Scala Developers
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
C language introduction
C language introduction C language introduction
C language introduction
 
C programming
C programming C programming
C programming
 
Python Programming - I. Introduction
Python Programming - I. IntroductionPython Programming - I. Introduction
Python Programming - I. Introduction
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#
 
Python Basics
Python BasicsPython Basics
Python Basics
 
FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015
 
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
 
Presentation on C++ programming
Presentation on C++ programming Presentation on C++ programming
Presentation on C++ programming
 
F# and the DLR
F# and the DLRF# and the DLR
F# and the DLR
 
C programming Ms. Pranoti Doke
C programming Ms. Pranoti DokeC programming Ms. Pranoti Doke
C programming Ms. Pranoti Doke
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1
 
The GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation WorldThe GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation World
 
File handling With Solve Programs
File handling With Solve ProgramsFile handling With Solve Programs
File handling With Solve Programs
 
# And ## operators in c
# And ## operators in c# And ## operators in c
# And ## operators in c
 
Python programming
Python programmingPython programming
Python programming
 
C++
C++C++
C++
 

Similaire à F# and functional programming

Boo Manifesto
Boo ManifestoBoo Manifesto
Boo Manifestohu hans
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional ProgrammingRyan Riley
 
What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#Kevin Hazzard
 
88 c programs 15184
88 c programs 1518488 c programs 15184
88 c programs 15184Sumit Saini
 
Bay NET Aug 19 2009 presentation ppt
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation pptArt Scott
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#Talbott Crowell
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdflailoesakhan
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpMichael Stal
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpMichael Stal
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programmingsamthemonad
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...PROIDEA
 

Similaire à F# and functional programming (20)

Lập trình C
Lập trình CLập trình C
Lập trình C
 
Boo Manifesto
Boo ManifestoBoo Manifesto
Boo Manifesto
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#
 
88 c programs 15184
88 c programs 1518488 c programs 15184
88 c programs 15184
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
 
F# 101
F# 101F# 101
F# 101
 
Bay NET Aug 19 2009 presentation ppt
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation ppt
 
F# Tutorial @ QCon
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QCon
 
OOP and FP
OOP and FPOOP and FP
OOP and FP
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Functional programming in C++
Functional programming in C++Functional programming in C++
Functional programming in C++
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programming
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...
[4DEV] Bartosz Sokół - Functional developer in object oriented world - how F#...
 

Dernier

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 RobisonAnna Loughnan Colquhoun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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...Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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 MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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.pptxHampshireHUG
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Dernier (20)

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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

F# and functional programming

  • 1. Functional programming and F# Sanko.net meeting 8.6.2011
  • 2. Agenda Functional programming from c# perspective, Linq principles Functional programming in general F# and C# interoperability F# examples: ’basic’ stuff F# vs. C#
  • 3. Agenda Functional programming from c# perspective, Linq principles Functional programming in general F# and C# interoperability F# examples: ’basic’ stuff F# vs. C# Eh? There’s a bug in the Agenda!!! Wrong order and names missing!
  • 4. This happens, when you Powerpoint without test harness! Lets kick the PowerPoint and.... Correct the agenda using....
  • 5. F#? This happens, when you Powerpoint without test harness! Lets kick the PowerPoint and.... Correct the agenda using....
  • 6. F#? This happens, when you Powerpoint without test harness! Lets kick the PowerPoint and.... Correct the agenda using.... Java guy? Great!
  • 7. Demo.... Source available @ github: https://github.com/ramik/Demo/blob/master/FunctionalTutorial/CSharpExamples/PresisDemo/SlideDemo.fs And if you don’t have internet access, snapshotted source just for you module SlideDemo open System; type PresentationKeeper(name: string, employer : string) = member lollis.name = name member fuulis.employer = employer override this.ToString() = name + ", " + employer let Rami = PresentationKeeper("Rami Karjalainen", "Reaktor") let Tuomas = PresentationKeeper("Tuomas Hietanen", "Basware") let topics = [ (2, "Functional programming from c# perspective, Linq principles", Tuomas); (1, "Functional programming in general", Rami); (3, "F# examples: ’basic’ stuff", Rami); (4, "F# and C# interoperability", Rami); (5, "F# vs. C#", Tuomas) ] let formatTopic topic keeper = String.Format ("{0} ({1})", topic, keeper.ToString()) let pimpTheList = topics |> Seq.sortBy (fun (prio,_,_) -> prio) |> Seq.map (fun (_, a, b) -> a,b) |> Seq.map (fun x -> (formatTopic (fst x) (snd x))) let printPimped x = x |> Seq.iter (fun c -> printfn "%s" c)
  • 9. Why F#? Well, simply because its fun!
  • 10. Why F#? Well, simply because its fun! (fun is reserved keyword, for expression)!
  • 11. F# has / is: Succint Closures Functional Generics Discrimated unions .net official language (v4  ) Pattern matching Tail recursion optimization Tuples Immutable by default asynchronous workflows Very expressive Interoperable Type inference Classes Infinite lists etc. (laziness) Strongly typed Hybrid (oo, imperative) Lambda expressions (anon func) REPL (interactive) OCaml
  • 12. F# has / is: But for now, lets focus on this! Functional
  • 13.
  • 14. Functions as first class ”citizens”
  • 16. No mutable state Many other concepts apply, but these are ones to focus in this presentation
  • 17. Immutability: Object cannot be changed after creation In C#, mark fields as readonly No mutable state  no local variables
  • 18.
  • 19. Recursion: In functional programming, no iteration or ”looping” Recursion is very important concept
  • 20.
  • 21.
  • 22.
  • 23. Time to switch to Visual Studio! (for good this time)