SlideShare a Scribd company logo
Onorio Catenacci
Shell Scripting With F#
CodeStock is proudly partnered with:




                RecruitWise and Staff with Excellence - www.recruitwise.jobs


      Send instant feedback on this session via Twitter:
        Send a direct message with the room number to @CodeStock
        d codestock 401 This session is great!

      For more information on sending feedback using Twitter while at
      CodeStock, please see the “CodeStock README” in your CodeStock guide.
what we do
 consulting       training     design      debugging

who we are
 Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – our
 mission is to help our customers achieve their goals through advanced software-based
 consulting and training solutions.

how we do it                                               Training
                                                           •   On-site instructor-led training
 Consulting & Debugging                                    •   Virtual instructor-led training
 •   Architecture, analysis, and design services           •   Devscovery conferences
 •   Full lifecycle custom software development
 •   Content creation                                      Design
 •   Project management                                    •   User Experience Design
 •   Debugging & performance tuning                        •   Visual & Content Design
                                                           •   Video & Animation Production


                                                                                      wintellect.com
• What We’ll Discuss
                            – Important Background
Shell Scripting With F#

                            – Use cases
                            – Code
                            – Additional resources
• Important Background
                            – Shell Scripting
                              • Want It Lightweight
Shell Scripting With F#


                                 – Rapid testing/prototyping
                                 – REPL
                              • Often driving apps via command-line
                              • Want One Language For All
                              • Shell Scripting Languages
                                 –   Cmd
                                 –   VBScript
                                 –   Powershell
                                 –   Bash
• Important Background
                            – Functional Programming
                                Immutable data by default (ex. 1, 2)
Shell Scripting With F#

                              •
                              • Lambda functions (ex. 3)
                              • Functions are “first class” (ex. 4,5,6)
                              • Currying/partial application vs. tupled
                                parameters (ex. 7,8, 9)
                              • Unit type (ex. 10)
                              • All functions return a value
• Important Background
                            – F#
                              • ML language family
Shell Scripting With F#


                                   – Standard ML
                                   – OCaml
                              •   Indentation sensitive by default
                              •   Types of values are inferred from usage
                              •   Some/None
                              •   |> (Pipe Forward)
                              •   All funcs must be declared before use
• Why Write A Shell Script?
                            – Wrap functionality which you can’t
                              change
Shell Scripting With F#


                            – Automate common operations
                            – Large batch jobs
• Why Use F# For Shell Scripting?
                            – One language which scales
Shell Scripting With F#

                            – Low ceremony
                              • Type inference
                            – Default immutability
                            – Good way to practice FP
                            – Free to choose your own for shell
                              scripting
• Code
                            – Command Line
                              • "C:Program Files (x86)Microsoft
Shell Scripting With F#


                                F#v4.0Fsi.exe" --exec <name of .fsx>
                                <args>
                              • Args are passed as array of strings
                              • args.[0] is name of script; actual args start at
                                args.[1]
                              • Last line of fsx invokes main func and
                                passes commandline args:
                                   – main fsi.CommandLineArgs;;
• Additional Resources
                            – Chris Smith’s “Scripting In F#”
Shell Scripting With F#

                              • http://blogs.msdn.com/b/chrsmith/archive/2008/09/
                                12/scripting-in-f.aspx
                            – Programming F# 3.0
                              • Chapter on F# Shell Scripting and Common Idioms
                            – Fake (F# Make Files) (Steffen Forkmann)
                              • https://github.com/forki/FAKE
                            – Finnikin (F# Shell Scripting Utility
                              Library)
                              • https://github.com/OnorioCatenacci/finnikin

More Related Content

PDF
NetWork - 15.10.2011 - Applied code generation in .NET
PPTX
Go: What's Different ?
KEY
Using Aspects for Language Portability (SCAM 2010)
PDF
The Spoofax Language Workbench (SPLASH 2010)
KEY
Language Engineering in the Cloud
PDF
Ruby formatters
PDF
IDE, Terminal and SCM to work with Ruby on Rails
PDF
Pragmatic Smalltalk
NetWork - 15.10.2011 - Applied code generation in .NET
Go: What's Different ?
Using Aspects for Language Portability (SCAM 2010)
The Spoofax Language Workbench (SPLASH 2010)
Language Engineering in the Cloud
Ruby formatters
IDE, Terminal and SCM to work with Ruby on Rails
Pragmatic Smalltalk

What's hot (19)

KEY
Test-driven language development
PPTX
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
PDF
Programming Language Selection
PPTX
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
PDF
PIL - A Platform Independent Language
PPTX
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
KEY
Remix Your Language Tooling (JSConf.eu 2012)
PDF
PDF
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
PPTX
P1 2017 python
PPTX
P1 2018 python
PDF
Enlightenment: A Cross Platform Window Manager & Toolkit
PPT
COMPUTER LANGUAGES AND THERE DIFFERENCE
PDF
The Future of Cross-Platform is Native
PPTX
Week 8 intro to python
KEY
Extending ZF & Extending With ZF
PDF
DSL Construction rith Ruby
PPTX
Velocity-EHF for Android
Test-driven language development
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Programming Language Selection
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
PIL - A Platform Independent Language
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
Remix Your Language Tooling (JSConf.eu 2012)
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
P1 2017 python
P1 2018 python
Enlightenment: A Cross Platform Window Manager & Toolkit
COMPUTER LANGUAGES AND THERE DIFFERENCE
The Future of Cross-Platform is Native
Week 8 intro to python
Extending ZF & Extending With ZF
DSL Construction rith Ruby
Velocity-EHF for Android
Ad

Similar to Shell scripting with f (20)

PPT
Evalution about programming language part 1
PPTX
Porting E-poetry: The Case of First Screening
PPTX
Overview new programming languages
PPT
Chapter14_Scripting_Languages_4e.power point presentation
PPTX
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
PPTX
Bioinformatica p1-perl-introduction
PDF
PDF
PPTX
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
PPTX
2016 bioinformatics i_python_part_1_wim_vancriekinge
PDF
The Architect Way - JSCamp.asia 2012
PPTX
Imperative Programing engineering ppt.pptx
PPT
C# Fundamental
PPT
Modified.net overview
PDF
Erlang - Concurrent Language for Concurrent World
PDF
Lecture - The .Net Technology and Framework
PPTX
Shell scrpting(payal harne)
PDF
Apache Drill (ver. 0.2)
PPTX
Ruby and Security
PPTX
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Evalution about programming language part 1
Porting E-poetry: The Case of First Screening
Overview new programming languages
Chapter14_Scripting_Languages_4e.power point presentation
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Bioinformatica p1-perl-introduction
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
2016 bioinformatics i_python_part_1_wim_vancriekinge
The Architect Way - JSCamp.asia 2012
Imperative Programing engineering ppt.pptx
C# Fundamental
Modified.net overview
Erlang - Concurrent Language for Concurrent World
Lecture - The .Net Technology and Framework
Shell scrpting(payal harne)
Apache Drill (ver. 0.2)
Ruby and Security
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Ad

More from OnorioCatenacci (6)

ODP
Basics Of Elixir and Phoenix
ODP
Gentle Introduction To Funcitonal Programming - Detroit.Code
PPT
Building An Elixir Package
PPTX
Alternate languages for the CLR
PPT
A RESTful Interface for Erlang Code using Webmachine
PPTX
A Sip Of Elixir
Basics Of Elixir and Phoenix
Gentle Introduction To Funcitonal Programming - Detroit.Code
Building An Elixir Package
Alternate languages for the CLR
A RESTful Interface for Erlang Code using Webmachine
A Sip Of Elixir

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
cuic standard and advanced reporting.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Electronic commerce courselecture one. Pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Cloud computing and distributed systems.
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
MIND Revenue Release Quarter 2 2025 Press Release
cuic standard and advanced reporting.pdf
A comparative analysis of optical character recognition models for extracting...
Electronic commerce courselecture one. Pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Review of recent advances in non-invasive hemoglobin estimation
Chapter 3 Spatial Domain Image Processing.pdf
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Unlocking AI with Model Context Protocol (MCP)
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Programs and apps: productivity, graphics, security and other tools
Cloud computing and distributed systems.
gpt5_lecture_notes_comprehensive_20250812015547.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Building Integrated photovoltaic BIPV_UPV.pdf

Shell scripting with f

  • 2. CodeStock is proudly partnered with: RecruitWise and Staff with Excellence - www.recruitwise.jobs Send instant feedback on this session via Twitter: Send a direct message with the room number to @CodeStock d codestock 401 This session is great! For more information on sending feedback using Twitter while at CodeStock, please see the “CodeStock README” in your CodeStock guide.
  • 3. what we do consulting training design debugging who we are Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – our mission is to help our customers achieve their goals through advanced software-based consulting and training solutions. how we do it Training • On-site instructor-led training Consulting & Debugging • Virtual instructor-led training • Architecture, analysis, and design services • Devscovery conferences • Full lifecycle custom software development • Content creation Design • Project management • User Experience Design • Debugging & performance tuning • Visual & Content Design • Video & Animation Production wintellect.com
  • 4. • What We’ll Discuss – Important Background Shell Scripting With F# – Use cases – Code – Additional resources
  • 5. • Important Background – Shell Scripting • Want It Lightweight Shell Scripting With F# – Rapid testing/prototyping – REPL • Often driving apps via command-line • Want One Language For All • Shell Scripting Languages – Cmd – VBScript – Powershell – Bash
  • 6. • Important Background – Functional Programming Immutable data by default (ex. 1, 2) Shell Scripting With F# • • Lambda functions (ex. 3) • Functions are “first class” (ex. 4,5,6) • Currying/partial application vs. tupled parameters (ex. 7,8, 9) • Unit type (ex. 10) • All functions return a value
  • 7. • Important Background – F# • ML language family Shell Scripting With F# – Standard ML – OCaml • Indentation sensitive by default • Types of values are inferred from usage • Some/None • |> (Pipe Forward) • All funcs must be declared before use
  • 8. • Why Write A Shell Script? – Wrap functionality which you can’t change Shell Scripting With F# – Automate common operations – Large batch jobs
  • 9. • Why Use F# For Shell Scripting? – One language which scales Shell Scripting With F# – Low ceremony • Type inference – Default immutability – Good way to practice FP – Free to choose your own for shell scripting
  • 10. • Code – Command Line • "C:Program Files (x86)Microsoft Shell Scripting With F# F#v4.0Fsi.exe" --exec <name of .fsx> <args> • Args are passed as array of strings • args.[0] is name of script; actual args start at args.[1] • Last line of fsx invokes main func and passes commandline args: – main fsi.CommandLineArgs;;
  • 11. • Additional Resources – Chris Smith’s “Scripting In F#” Shell Scripting With F# • http://blogs.msdn.com/b/chrsmith/archive/2008/09/ 12/scripting-in-f.aspx – Programming F# 3.0 • Chapter on F# Shell Scripting and Common Idioms – Fake (F# Make Files) (Steffen Forkmann) • https://github.com/forki/FAKE – Finnikin (F# Shell Scripting Utility Library) • https://github.com/OnorioCatenacci/finnikin