SlideShare a Scribd company logo
Exploring SharePoint with F#Talbott Crowell (MVP)@TalbottSharePoint Saturday New York CityJuly 30, 2011
Learn something new (exercise for the brain)Trend in functional programmingJava -> Clojure, ScalaErlangLINQ added to VB and C#Microsoft’s official (and only) functional programming languageWhy F#
Functional programming has been around a long timeNot newLong historyFunctional programming is safeA concern as we head toward manycore and cloud computingWhy another language?
1930’s: lambda calculus (roots)1956: IPL (Information Processing Language) “the first functional language1958: LISP “a functional flavored language”1962: APL (A Programming Language)1973: ML (Meta Language)1983: SML (Standard ML)1987: Caml (Categorical Abstract Machine Language ) and Haskell1996: OCaml (Objective Caml)Functional programming has been around a long time
Functional language developed by Microsoft ResearchBy Don Syme and his team, who productized GenericsBased on OCaml (influenced by C# and Haskell)History2002: F# language design started2005 January: F# 1.0.1 releases to publicNot a product.  Integration with VS2003Works in .NET 1.0 through .NET 2.0 beta, Mono2005 November: F# 1.1.5 with VS 2005 RTM support2009 October: VS2010 Beta 2, CTP for VS2008 & Non-Windows users2010: F# is “productized” and baked into VS 2010What is F#
Interactive Scripting Uses REPL (Read Evaluate Print Loop)Good for prototypingSuccinct = Less codeType InferenceStrongly typed, strictAutomatic generalization (generics for free)Few type annotations1st class functions (currying, lazy evaluations)Pattern matchingKey Characteristics of F#
Functional firstMutable keywordFunctions are first class valuesBlend of functional and imperativeObject oriented capabilitiesBuilt on .NET FrameworkPracticalLeverage existing codeWhat I like about F#
What is manycore?Lots of processors on one chipTens or hundredsIntel – Future (Task parallelism)NVIDIA GPU – Today (Data parallelism)500+ cores on chipGraphics, gaming, 3D renderingUse CUDA for financial or research computingProgram in C or C++
The Power Wall: CPU Clock SpeedManycore->Multicore->Single core->From Katherine Yelick’s “Multicore: Fallout of a Hardware Revolution”
Road to manycore1970 – 2005Single core on the “desktop” and laptop2006 – 2011Single core on the smartphone/tabletMulti core on the “desktop”Multi core in the cloud2012 – 2020Multi core on the smartphone/tablet2021Manycore probably will be common on many devices and computers
Multicore for Smartphones/TabletsAndroid 2.2 already supports multicoreNVIDIA dual core test with one core shut off1.5 to 1.6x faster with two coreshttp://bit.ly/nvidiadualcoreNVIDIA quad core on its waySmartphones by holiday season 2011Faster than 2 GHz notebook Core 2 Duo (T7200)http://bit.ly/eWMOsuQualcomm quad core SnapDragonDevices expected in 2013Intel announcing entry into Smartphone market
Declarative programming style	Easier to introduce parallelism into existing codeImmutability by defaultCan’t introduce race conditionsEasier to write lock-free codeFunctional Programming
Type inferenceExpressionsF# Basicslet x = 5let y = 5.0 let files = Directory.GetFiles(@"C:\images\original")let x = 5 * 5let y = 5.0 / 3.0let width = image.Width / 8
FunctionAnonymous functionsF# Functionslet sqr x = x * xsqr 5(fun x -> x * x) 5
The |> Combinator “Pipe Forward” ExampleF# Combinators x |> f          is the same as        f x  let sqr x = x * xsqr 5  5 |> sqr
The <| Combinator “Pipe Backward” ExampleF# Combinators f <| x          is the same as        f x  let sqr x = x * xsqr 5sqr <| 3 + 2       not same as    sqr 3 + 2
Similar to operator overloading ExampleSymbolic Functions let (operatorName) left right = <function>  open System.Text.RegularExpressions let (===) str regex = Regex.Match(str, regex).Success
Client Object Model
Exploring SharePoint with F#
Adding References
For more info on Client Object ModelSee “Using the SharePoint Foundation 2010 Managed Client Object Model”http://msdn.microsoft.com/en-us/library/ee857094(office.14).aspx
Load References FSX ScriptOpen namespaceClient Object Model Assemblies#r @"..\ReferenceAssemblies\Microsoft.SharePoint.Client.dll"           #r @"..\ReferenceAssemblies\Microsoft.SharePoint.Client.Runtime.dll"open Microsoft.SharePoint.Client
Create SharePoint Client ContextPass CredentialsClient Context and Credentialslet ctx = new ClientContext("http://fsug.org")ctx.Credentials <- new NetworkCredential(	user, password, domain)
Helper function to Load and QueryRetrieve Site CollectionLoad and Query Contextlet load(ctx:ClientContext)(item:'a) =   ctx.Load(item)ctx.ExecuteQuery() let site = ctx.Site load ctx site
Site Collection (Site) and Site (Web)Site Collection and Sitelet site = ctx.Site load ctx site let web = site.RootWeb load ctx weblet title = web.Title
Use for loop to iterate through listsIterate through Lists load ctxweb.Lists for list in web.Lists do    print <| "List Title: " + list.Title
Query for list items using CAMLUse for loop to iterate through list itemsIterate through List Itemslet fsugMeetings = web.Lists.GetByTitle("FSUG Meetings")let query = new CamlQuery()query.ViewXml <- "<View><Query><OrderBy>...let listItems = fsugMeetings.GetItems(query)ctx.Load(fsugMeetings);ctx.Load(listItems);ctx.ExecuteQuery();for meeting in listItems do    print <| "Meeting: " + meeting.["Title"].ToString()
Use for loop to iterate through listsIterate through Lists load ctxweb.Lists for list in web.Lists do    print <| "List Title: " + list.Title
Demo
Future of F#Solution for the Data DelugeType ProvidersVideo by Keith Battocchi
Questions?
Thank YouReferences:http://TryFsharp.orgPlay with F# on browserTutorialLoad and save fileshttp://fsharp.netMore information
My InfoTalbott CrowellF# MVPhttp://fsug.orgNew England F# User Grouphttp://twitter.com/talbott  @talbott@BASPUGBoston Area SharePoint User Grouphttp://ThirdM.comThird Millennium, Inc.  Chief Architect

More Related Content

PPTX
Declarative authorization in REST services in SharePoint with F# and ServiceS...
PDF
.Net passé, présent et futur
PPTX
C# 6 and 7 and Futures 20180607
PDF
A la découverte de TypeScript
PDF
C# and vb
PPT
Visual Studio .NET2010
PPTX
FSharp eye for the Haskell guy - London 2015
PPT
Smoothing Your Java with DSLs
Declarative authorization in REST services in SharePoint with F# and ServiceS...
.Net passé, présent et futur
C# 6 and 7 and Futures 20180607
A la découverte de TypeScript
C# and vb
Visual Studio .NET2010
FSharp eye for the Haskell guy - London 2015
Smoothing Your Java with DSLs

What's hot (18)

PPTX
Object oriented programming 7 first steps in oop using c++
PPTX
c# usage,applications and advantages
PPTX
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
PPTX
C++ vs C#
PPT
Intro dotnet
PPTX
C vs c++
PPTX
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
PDF
Differences between c and c++
PPT
Basic structure of C++ program
PPTX
F# for functional enthusiasts
PDF
(1) c sharp introduction_basics_dot_net
PPTX
JS Fest 2018. Виталий Ратушный. ES X
PDF
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
PPTX
C and C ++ Training in Ambala ! BATRA COMPUTER CENTRE
PPT
C++ questions and answers
PPTX
PPSX
Session Four C#
Object oriented programming 7 first steps in oop using c++
c# usage,applications and advantages
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
C++ vs C#
Intro dotnet
C vs c++
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
Differences between c and c++
Basic structure of C++ program
F# for functional enthusiasts
(1) c sharp introduction_basics_dot_net
JS Fest 2018. Виталий Ратушный. ES X
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
C and C ++ Training in Ambala ! BATRA COMPUTER CENTRE
C++ questions and answers
Session Four C#
Ad

Similar to Exploring SharePoint with F# (20)

PPTX
Introduction to F#
PPTX
F# and functional programming
PPTX
London F-Sharp User Group : Don Syme on F# - 09/09/2010
PDF
The F# Path to Relaxation
PPTX
Async and Parallel F#
PPTX
Async and Parallel F#
PPTX
"The F# Path to Relaxation", Don Syme
PPTX
Qcon2011 functions rockpresentation_f_sharp
PPTX
Qcon2011 functions rockpresentation_f_sharp
ODP
F# 101
PDF
Functional Programming in F#
PPTX
F# Tutorial @ QCon
PPT
Bay NET Aug 19 2009 presentation ppt
PPTX
TechDaysNL 2015 - F# for C# Developers
PPTX
F# eXchange Keynote 2016
PPTX
Domain Modeling & Full-Stack Web Development F#
PPT
F# Sample and Resources
PPTX
Sharper tools with F#
PPTX
F# intro
PPTX
Tech Days Paris Intoduction F# and Collective Intelligence
Introduction to F#
F# and functional programming
London F-Sharp User Group : Don Syme on F# - 09/09/2010
The F# Path to Relaxation
Async and Parallel F#
Async and Parallel F#
"The F# Path to Relaxation", Don Syme
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
F# 101
Functional Programming in F#
F# Tutorial @ QCon
Bay NET Aug 19 2009 presentation ppt
TechDaysNL 2015 - F# for C# Developers
F# eXchange Keynote 2016
Domain Modeling & Full-Stack Web Development F#
F# Sample and Resources
Sharper tools with F#
F# intro
Tech Days Paris Intoduction F# and Collective Intelligence
Ad

More from Talbott Crowell (18)

PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
PPTX
Top 7 mistakes
PPTX
Top 3 Mistakes when Building
PPTX
Building high performance and scalable share point applications
PPTX
Road to the Cloud - Extending your reach with SharePoint and Office 365
PPTX
Custom Development for SharePoint
PPTX
Custom Development in SharePoint – What are my options now?
PPTX
Developing a Provider Hosted SharePoint app
PPTX
Developing a provider hosted share point app
PPTX
Introduction to F# 3.0
PPTX
PowerShell and SharePoint @spsnyc July 2012
PPTX
PowerShell and SharePoint
PPTX
Welcome to windows 8
PPTX
Automating PowerShell with SharePoint
PPTX
F# And Silverlight
PPTX
SharePoint Saturday Boston 2010
PPT
Automating SQL Server Database Creation for SharePoint
PPTX
Architecting Solutions for the Manycore Future
Talbott's brief History of Computers for CollabDays Hamburg 2025
Top 7 mistakes
Top 3 Mistakes when Building
Building high performance and scalable share point applications
Road to the Cloud - Extending your reach with SharePoint and Office 365
Custom Development for SharePoint
Custom Development in SharePoint – What are my options now?
Developing a Provider Hosted SharePoint app
Developing a provider hosted share point app
Introduction to F# 3.0
PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint
Welcome to windows 8
Automating PowerShell with SharePoint
F# And Silverlight
SharePoint Saturday Boston 2010
Automating SQL Server Database Creation for SharePoint
Architecting Solutions for the Manycore Future

Recently uploaded (20)

PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Sensors and Actuators in IoT Systems using pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 2 Digital Image Fundamentals.pdf
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Review of recent advances in non-invasive hemoglobin estimation
Sensors and Actuators in IoT Systems using pdf
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 2 Digital Image Fundamentals.pdf
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Advanced Soft Computing BINUS July 2025.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
GamePlan Trading System Review: Professional Trader's Honest Take
Chapter 3 Spatial Domain Image Processing.pdf
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
Understanding_Digital_Forensics_Presentation.pptx
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...

Exploring SharePoint with F#

  • 1. Exploring SharePoint with F#Talbott Crowell (MVP)@TalbottSharePoint Saturday New York CityJuly 30, 2011
  • 2. Learn something new (exercise for the brain)Trend in functional programmingJava -> Clojure, ScalaErlangLINQ added to VB and C#Microsoft’s official (and only) functional programming languageWhy F#
  • 3. Functional programming has been around a long timeNot newLong historyFunctional programming is safeA concern as we head toward manycore and cloud computingWhy another language?
  • 4. 1930’s: lambda calculus (roots)1956: IPL (Information Processing Language) “the first functional language1958: LISP “a functional flavored language”1962: APL (A Programming Language)1973: ML (Meta Language)1983: SML (Standard ML)1987: Caml (Categorical Abstract Machine Language ) and Haskell1996: OCaml (Objective Caml)Functional programming has been around a long time
  • 5. Functional language developed by Microsoft ResearchBy Don Syme and his team, who productized GenericsBased on OCaml (influenced by C# and Haskell)History2002: F# language design started2005 January: F# 1.0.1 releases to publicNot a product. Integration with VS2003Works in .NET 1.0 through .NET 2.0 beta, Mono2005 November: F# 1.1.5 with VS 2005 RTM support2009 October: VS2010 Beta 2, CTP for VS2008 & Non-Windows users2010: F# is “productized” and baked into VS 2010What is F#
  • 6. Interactive Scripting Uses REPL (Read Evaluate Print Loop)Good for prototypingSuccinct = Less codeType InferenceStrongly typed, strictAutomatic generalization (generics for free)Few type annotations1st class functions (currying, lazy evaluations)Pattern matchingKey Characteristics of F#
  • 7. Functional firstMutable keywordFunctions are first class valuesBlend of functional and imperativeObject oriented capabilitiesBuilt on .NET FrameworkPracticalLeverage existing codeWhat I like about F#
  • 8. What is manycore?Lots of processors on one chipTens or hundredsIntel – Future (Task parallelism)NVIDIA GPU – Today (Data parallelism)500+ cores on chipGraphics, gaming, 3D renderingUse CUDA for financial or research computingProgram in C or C++
  • 9. The Power Wall: CPU Clock SpeedManycore->Multicore->Single core->From Katherine Yelick’s “Multicore: Fallout of a Hardware Revolution”
  • 10. Road to manycore1970 – 2005Single core on the “desktop” and laptop2006 – 2011Single core on the smartphone/tabletMulti core on the “desktop”Multi core in the cloud2012 – 2020Multi core on the smartphone/tablet2021Manycore probably will be common on many devices and computers
  • 11. Multicore for Smartphones/TabletsAndroid 2.2 already supports multicoreNVIDIA dual core test with one core shut off1.5 to 1.6x faster with two coreshttp://bit.ly/nvidiadualcoreNVIDIA quad core on its waySmartphones by holiday season 2011Faster than 2 GHz notebook Core 2 Duo (T7200)http://bit.ly/eWMOsuQualcomm quad core SnapDragonDevices expected in 2013Intel announcing entry into Smartphone market
  • 12. Declarative programming style Easier to introduce parallelism into existing codeImmutability by defaultCan’t introduce race conditionsEasier to write lock-free codeFunctional Programming
  • 13. Type inferenceExpressionsF# Basicslet x = 5let y = 5.0 let files = Directory.GetFiles(@"C:\images\original")let x = 5 * 5let y = 5.0 / 3.0let width = image.Width / 8
  • 14. FunctionAnonymous functionsF# Functionslet sqr x = x * xsqr 5(fun x -> x * x) 5
  • 15. The |> Combinator “Pipe Forward” ExampleF# Combinators x |> f is the same as f x let sqr x = x * xsqr 5 5 |> sqr
  • 16. The <| Combinator “Pipe Backward” ExampleF# Combinators f <| x is the same as f x let sqr x = x * xsqr 5sqr <| 3 + 2 not same as sqr 3 + 2
  • 17. Similar to operator overloading ExampleSymbolic Functions let (operatorName) left right = <function> open System.Text.RegularExpressions let (===) str regex = Regex.Match(str, regex).Success
  • 21. For more info on Client Object ModelSee “Using the SharePoint Foundation 2010 Managed Client Object Model”http://msdn.microsoft.com/en-us/library/ee857094(office.14).aspx
  • 22. Load References FSX ScriptOpen namespaceClient Object Model Assemblies#r @"..\ReferenceAssemblies\Microsoft.SharePoint.Client.dll" #r @"..\ReferenceAssemblies\Microsoft.SharePoint.Client.Runtime.dll"open Microsoft.SharePoint.Client
  • 23. Create SharePoint Client ContextPass CredentialsClient Context and Credentialslet ctx = new ClientContext("http://fsug.org")ctx.Credentials <- new NetworkCredential( user, password, domain)
  • 24. Helper function to Load and QueryRetrieve Site CollectionLoad and Query Contextlet load(ctx:ClientContext)(item:'a) = ctx.Load(item)ctx.ExecuteQuery() let site = ctx.Site load ctx site
  • 25. Site Collection (Site) and Site (Web)Site Collection and Sitelet site = ctx.Site load ctx site let web = site.RootWeb load ctx weblet title = web.Title
  • 26. Use for loop to iterate through listsIterate through Lists load ctxweb.Lists for list in web.Lists do print <| "List Title: " + list.Title
  • 27. Query for list items using CAMLUse for loop to iterate through list itemsIterate through List Itemslet fsugMeetings = web.Lists.GetByTitle("FSUG Meetings")let query = new CamlQuery()query.ViewXml <- "<View><Query><OrderBy>...let listItems = fsugMeetings.GetItems(query)ctx.Load(fsugMeetings);ctx.Load(listItems);ctx.ExecuteQuery();for meeting in listItems do print <| "Meeting: " + meeting.["Title"].ToString()
  • 28. Use for loop to iterate through listsIterate through Lists load ctxweb.Lists for list in web.Lists do print <| "List Title: " + list.Title
  • 29. Demo
  • 30. Future of F#Solution for the Data DelugeType ProvidersVideo by Keith Battocchi
  • 32. Thank YouReferences:http://TryFsharp.orgPlay with F# on browserTutorialLoad and save fileshttp://fsharp.netMore information
  • 33. My InfoTalbott CrowellF# MVPhttp://fsug.orgNew England F# User Grouphttp://twitter.com/talbott @talbott@BASPUGBoston Area SharePoint User Grouphttp://ThirdM.comThird Millennium, Inc. Chief Architect