45 F#antastic minutes!

Post on 10-May-2015

129 views 0 download

Tags:

Transcript of 45 F#antastic minutes!

Getting Started with F#

Alex Casqueteacasquete

45 F#antastic minutes!

Alex Casqueteacasquete

Functional Programming

is not newbut is ignored

until now

Process large datasetsScale to processors & computers

Easily testingDeclarative logic

The Challenges

“Take the next ticket from a list. If theticket is not printed, send to print. If

there are more tickets in the list, go tothe begining.”

“Run the first command for everycustomer for which the second

command returns true.”

“Send to print every ticket that is not printed.”

“Take the next ticket from a list. If theticket is not printed, send to print. If

there are more tickets in the list, go tothe begining.”

“Send to print every ticket that is not printed.”

Thinking difɘrɘntlySay “what” rather than “how”

foreach (Ticket t in Tickets){

if (!t.IsPrinted){

Print(t);}

}

Tickets.Where(t=>!t.IsPrinted).ToList().ForEach(t => Print(t));

Thinking difɘrɘntly in C#

Imperative Declarative

Functional Basic ConceptsDemo: From C# to F#

Functional Basic ConceptsImmutability

RecursionHigher order

10 Reasons not to useFunctional Programming

<ironic>

</ironic>

Reason 1I don't want to follow the latest fad

Reason 2I get paid by the line

I get paid by the line

I get paid by the line

Reason 3{ I love me some curly braces }

Reason 4string s = “I like to see explicit types”;

Reason 5I like to fix vugs

Reason 6I live in the debugger

Reason 7I don't want to think about

every little detail

Reason 8I like to check for != nulls

Reason 9I like to use

design patterns everywhere

Reason 10It's very freaky

Why use F#?The Five C’s

ConcisenessConvenienceCorrectnessConcurrency

Completeness

Understanding F#

Data, Services, Information

Access

Transformations, Analysis,

Algorithms, Code, Parallel

Presentation, Publication, Experience

F# 3.0 F# 2.0 C#, HTML5, JS

Type providersDemo: OData, WSDL

More Resources?

http://Fsharp.org

http://FsharpForFunAndProfit.com

http://www.fssnip.net/

Thanks! Questions?

Alex Casqueteacasquete