SlideShare uma empresa Scribd logo
1 de 18
{
F#ture
and F#nctional Programming
Rodrigo Vidal
Twitter: @rodrigovidal
Blog: www.rodrigovidal.net
 Focus on Software Architecture
 F# and IronRuby/Ruby enthusiast.
 .NetArchitects – Rio de Janeiro , user group member
 Professional Scrum Developer
Quem sou eu?
 Old Paradigm
 52 years old
 Ignored by MainStream until now.
Functional Programming
 New Challenges
 Process big amount of data
 Escale to Clusters and Cores
Functional- Why now?
 Think out of the box
 Functional Programming is “safe”
 MultiCore and Cloud Computing applications
 Functional Programming is obtaning market
Why learn another language?
Imperative Vs. Declarative
What rather than How
Another way of thinking
List<string> res = new List<string>();
foreach(Product p in Products) {
if (p.UnitPrice > 75.0M) {
res.Add(String.Format("{0} - ${1}",
p.ProductName, p.UnitPrice));
}
}
var res = from p in Products
where p.UnitPrice > 75.0M
select string.Format("{0} - ${1}",
p.ProductName, p.UnitPrice);
return res;
Functional Paradigm
 Immutable Data
 Ability to compose functions
 Functions can be thread as data
 Lazy Evalution
 Pattern Matching
Immutability
“Values are immutable by default”
let x = 3
let x = 4
error FS0037: Duplicate definition of value ‘x'
Side-Effects
 A side effect
 Modifies some state
 Has observable interaction with calling functions
 Has observable interaction with the outside world
 Example: a function or method with no return value
let mutable x = 3
let y = x*3
x <- 4
let z = x*3
Composing Functions
f(x) = 3x+2
g(y) = 4y-1
Z = g(f(2)) = ?
f(x)
g(x)
let f x = 3*x + 2
let g y = (4*y) - 1
let z = g(f(2))
#Inception
Lambda
Calculus
LISP ML Ocaml Haskell F#
Languages Evolution
0
2
4
6
8
10
12
0 2 4 6 8 10 12
Usefulness
Safety
C#
Nirvana
Haskell
LINQ
C#, VB,
Java
LINQ Nirvana
Haskell
http://channel9.msdn.com/posts/Charles/Simon-Peyton-Jones-Towards-a-Programming-Language-Nirvana/
C#, VB, Java, C are
imperative
programming
languages. Very
useful but can change
the state of the world
at anytime creating
side effects.
Nirvana!
Useful and
Safe
Haskell is Very Safe, but
not very useful. Used
heavily in research and
academia, but rarely in
business.
F#
What´s is F#?
 Functional language developed by Microsoft Research
 By Don Syme and his team, who productized Generics
 Based on OCaml (influenced by C# and Haskell)
F# Evolution
2002
F# language
design started
2005 January
F# 1.0.1 releases
to public
2005 November
F# 1.1.5 with VS
2005 RTM support
2009 October
VS2010 Beta 2,
CTP for VS2008
& Non-
Windows users
2010
F# is
“productized”
and baked into
VS 2010
F# 2.0
Functional + Objects + .NET +
Async + Parallel + Interactive + Scripting
F# 2.0
//F#
open System
let a = 2
Console.WriteLine a
//C#
using System;
namespace ConsoleApplication1
{
class Program
{
static int a()
{
return 2;
}
static void Main(string[] args)
{
Console.WriteLine(a);
}
}
}
let fim = “Obrigado”

Mais conteúdo relacionado

Mais procurados

The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!
ryutenchi
 

Mais procurados (15)

[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
 
History of c++
History of c++History of c++
History of c++
 
C++ language
C++ languageC++ language
C++ language
 
Internet Technology (October – 2016) [Revised Syllabus | Question Paper]
Internet Technology (October – 2016) [Revised Syllabus | Question Paper]Internet Technology (October – 2016) [Revised Syllabus | Question Paper]
Internet Technology (October – 2016) [Revised Syllabus | Question Paper]
 
The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!
 
D programming language
D programming languageD programming language
D programming language
 
15CS664 Python Question Bank-3
15CS664 Python Question Bank-315CS664 Python Question Bank-3
15CS664 Python Question Bank-3
 
Functional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative ProgrammersFunctional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative Programmers
 
[C++ korea] effective modern c++ study item 4 - 6 신촌
[C++ korea] effective modern c++ study   item 4 - 6 신촌[C++ korea] effective modern c++ study   item 4 - 6 신촌
[C++ korea] effective modern c++ study item 4 - 6 신촌
 
[Question Paper] Object Oriented Programming With C++ (Revised Course) [Janua...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [Janua...[Question Paper] Object Oriented Programming With C++ (Revised Course) [Janua...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [Janua...
 
15CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 115CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 1
 
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
 
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015][Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
 
[Question Paper] Object Oriented Programming With C++ (Revised Course) [April...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [April...[Question Paper] Object Oriented Programming With C++ (Revised Course) [April...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [April...
 
Java and Data Structure (September - 2013) [Revised Course | Question Paper]
Java and Data Structure (September - 2013) [Revised Course | Question Paper]Java and Data Structure (September - 2013) [Revised Course | Question Paper]
Java and Data Structure (September - 2013) [Revised Course | Question Paper]
 

Destaque (7)

TRABAJANDO EN "EDMODO"
TRABAJANDO EN "EDMODO"TRABAJANDO EN "EDMODO"
TRABAJANDO EN "EDMODO"
 
Ejercicio 10
Ejercicio 10Ejercicio 10
Ejercicio 10
 
Bachelors diploma
Bachelors diplomaBachelors diploma
Bachelors diploma
 
Canaoeste e iac realizam dia de campo
Canaoeste e iac realizam dia de campoCanaoeste e iac realizam dia de campo
Canaoeste e iac realizam dia de campo
 
Patrimonio cultural de colombia. ec
Patrimonio cultural de colombia. ecPatrimonio cultural de colombia. ec
Patrimonio cultural de colombia. ec
 
Champion Care Corp Overview
Champion Care Corp OverviewChampion Care Corp Overview
Champion Care Corp Overview
 
raychem Kits adjacent to this range, both overlap this range.
raychem Kits adjacent to this range, both overlap this range.raychem Kits adjacent to this range, both overlap this range.
raychem Kits adjacent to this range, both overlap this range.
 

Semelhante a F# Ignite - DNAD2010

Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
Janeve George
 
20100730 phpstudy
20100730 phpstudy20100730 phpstudy
20100730 phpstudy
Yusuke Ando
 

Semelhante a F# Ignite - DNAD2010 (20)

F# Functional and MultiCore Programming
F# Functional and MultiCore Programming F# Functional and MultiCore Programming
F# Functional and MultiCore Programming
 
F# and the DLR
F# and the DLRF# and the DLR
F# and the DLR
 
Reproducibility with R
Reproducibility with RReproducibility with R
Reproducibility with R
 
Twins: Object Oriented Programming and Functional Programming
Twins: Object Oriented Programming and Functional ProgrammingTwins: Object Oriented Programming and Functional Programming
Twins: Object Oriented Programming and Functional Programming
 
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Special topics in finance lecture 2
Special topics in finance   lecture 2Special topics in finance   lecture 2
Special topics in finance lecture 2
 
"The F# Path to Relaxation", Don Syme
"The F# Path to Relaxation", Don Syme"The F# Path to Relaxation", Don Syme
"The F# Path to Relaxation", Don Syme
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
 
Java 8 Lambda
Java 8 LambdaJava 8 Lambda
Java 8 Lambda
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
 
Functional Programming and Big Data
Functional Programming and Big DataFunctional Programming and Big Data
Functional Programming and Big Data
 
Lambdas & Streams
Lambdas & StreamsLambdas & Streams
Lambdas & Streams
 
Dev Concepts: Functional Programming
Dev Concepts: Functional ProgrammingDev Concepts: Functional Programming
Dev Concepts: Functional Programming
 
Programming Languages: some news for the last N years
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N years
 
Python and Zope: An introduction (May 2004)
Python and Zope: An introduction (May 2004)Python and Zope: An introduction (May 2004)
Python and Zope: An introduction (May 2004)
 
20100730 phpstudy
20100730 phpstudy20100730 phpstudy
20100730 phpstudy
 

Mais de Rodrigo Vidal (7)

Fij
FijFij
Fij
 
F#3.0
F#3.0 F#3.0
F#3.0
 
Monadic Design
Monadic DesignMonadic Design
Monadic Design
 
C5, vb11, f3
C5, vb11, f3C5, vb11, f3
C5, vb11, f3
 
DevDay BH 2011 Programação Funcional
DevDay BH 2011 Programação FuncionalDevDay BH 2011 Programação Funcional
DevDay BH 2011 Programação Funcional
 
WebCamps Software Testing
WebCamps Software TestingWebCamps Software Testing
WebCamps Software Testing
 
Computacao em nuvem windows azure
Computacao em nuvem   windows azureComputacao em nuvem   windows azure
Computacao em nuvem windows azure
 

Último

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
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...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
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
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

F# Ignite - DNAD2010

  • 2. Rodrigo Vidal Twitter: @rodrigovidal Blog: www.rodrigovidal.net  Focus on Software Architecture  F# and IronRuby/Ruby enthusiast.  .NetArchitects – Rio de Janeiro , user group member  Professional Scrum Developer Quem sou eu?
  • 3.  Old Paradigm  52 years old  Ignored by MainStream until now. Functional Programming
  • 4.  New Challenges  Process big amount of data  Escale to Clusters and Cores Functional- Why now?
  • 5.  Think out of the box  Functional Programming is “safe”  MultiCore and Cloud Computing applications  Functional Programming is obtaning market Why learn another language?
  • 7. Another way of thinking List<string> res = new List<string>(); foreach(Product p in Products) { if (p.UnitPrice > 75.0M) { res.Add(String.Format("{0} - ${1}", p.ProductName, p.UnitPrice)); } } var res = from p in Products where p.UnitPrice > 75.0M select string.Format("{0} - ${1}", p.ProductName, p.UnitPrice); return res;
  • 8. Functional Paradigm  Immutable Data  Ability to compose functions  Functions can be thread as data  Lazy Evalution  Pattern Matching
  • 9. Immutability “Values are immutable by default” let x = 3 let x = 4 error FS0037: Duplicate definition of value ‘x'
  • 10. Side-Effects  A side effect  Modifies some state  Has observable interaction with calling functions  Has observable interaction with the outside world  Example: a function or method with no return value let mutable x = 3 let y = x*3 x <- 4 let z = x*3
  • 11. Composing Functions f(x) = 3x+2 g(y) = 4y-1 Z = g(f(2)) = ? f(x) g(x) let f x = 3*x + 2 let g y = (4*y) - 1 let z = g(f(2))
  • 13. Languages Evolution 0 2 4 6 8 10 12 0 2 4 6 8 10 12 Usefulness Safety C# Nirvana Haskell LINQ C#, VB, Java LINQ Nirvana Haskell http://channel9.msdn.com/posts/Charles/Simon-Peyton-Jones-Towards-a-Programming-Language-Nirvana/ C#, VB, Java, C are imperative programming languages. Very useful but can change the state of the world at anytime creating side effects. Nirvana! Useful and Safe Haskell is Very Safe, but not very useful. Used heavily in research and academia, but rarely in business. F#
  • 14. What´s is F#?  Functional language developed by Microsoft Research  By Don Syme and his team, who productized Generics  Based on OCaml (influenced by C# and Haskell)
  • 15. F# Evolution 2002 F# language design started 2005 January F# 1.0.1 releases to public 2005 November F# 1.1.5 with VS 2005 RTM support 2009 October VS2010 Beta 2, CTP for VS2008 & Non- Windows users 2010 F# is “productized” and baked into VS 2010
  • 16. F# 2.0 Functional + Objects + .NET + Async + Parallel + Interactive + Scripting
  • 17. F# 2.0 //F# open System let a = 2 Console.WriteLine a //C# using System; namespace ConsoleApplication1 { class Program { static int a() { return 2; } static void Main(string[] args) { Console.WriteLine(a); } } }
  • 18. let fim = “Obrigado”