Tech for Devs:Introduction to F#Rob Rohr12:30 - 1:30Sep 11, 2010Kalkin HallUniversity of Vermont
Functional ProgrammingEmphasize application of functions over mutation of state (imperative programming style)
Um.  Yeah.  What?Functionalfun inc x => x + 1Imperativex = x + 1
Important differencesAcademics – especially mathematicians -  love functional programming!Type safety through inferenceLack of side effects
Heh! What is it good for?Mathematical modelingProgramming languagesi.e., DSLsList processingParallel programmingConcise code, fewer bugs!(“Absolutely nothing?”)
Popular functional programming languagesErlangLispSchemeHaskellOCaml/MLF#
Why F#, then?Superset of OCamlFull access to .NETObject OrientedFirst class toolsUnits!Y!
DEMOWorking with F# in Visual Studio
Important:  LetLet keywordNot assignment
Binds value to symbol
ImmutableImportant:  |>Pipeline operator ( |> )Feed results of one function into input of nextTakes advantage of easy composition of functionsRemoves many possible errors
Important:  funDefine a function in lineAnonymous functionLambda expression!
F# Powerpackhttp://fsharppowerpack.codeplex.com/Matrix libraryFsLexx & FsYaccLINQ in F#HTML Docs from F# codeHashMultiMapSI Units of Measure
Parallelizable!How do I parallelize my map/reduce/fold code?Seq.map -> Seq.pmapetc.
AvailabilityYOU MAY ALREADY HAVE IT Included in Visual Studio 2010OR, FOR FREE, Can install VS2010 Shell with August release of F# 2.0Can install VS2008 Shell with August release of F# 2.0Can install F# 2.0 for Mono/Mac/Linux/Windowshttp://research.microsoft.com/en-us/um/cambridge/projects/fsharp/release.aspx
ResourcesF# Developer Centerhttp://fsharp.netParallel Sampleshttp://tomasp.net/blog/fsharp-parallel-samples.aspxChris Smith bloghttp://blogs.msdn.com/b/chrsmith/Luca Bolognese bloghttp://lucabolognese.wordpress.com/
More ResourcesF# at Microsoft Researchhttp://research.microsoft.com/en-us/um/cambridge/projects/fsharp/Don Syme’s bloghttp://blogs.msdn.com/b/dsyme/Luke Hoban’s bloghttp://blogs.msdn.com/b/lukeh/

Tech for devs, F#