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

What's hot

Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language development
lennartkats
 
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
lennartkats
 
Week 8 intro to python
Week 8   intro to pythonWeek 8   intro to python
Week 8 intro to python
brianjihoonlee
 

What's hot (19)

Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language development
 
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
Programming Language Selection
Programming Language SelectionProgramming Language Selection
Programming Language Selection
 
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
PIL - A Platform Independent Language
PIL - A Platform Independent LanguagePIL - A Platform Independent Language
PIL - A Platform Independent Language
 
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
 
Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)
 
201811xx foredrag c_cpp
201811xx foredrag c_cpp201811xx foredrag c_cpp
201811xx foredrag c_cpp
 
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
 
P1 2017 python
P1 2017 pythonP1 2017 python
P1 2017 python
 
P1 2018 python
P1 2018 pythonP1 2018 python
P1 2018 python
 
Enlightenment: A Cross Platform Window Manager & Toolkit
Enlightenment: A Cross Platform Window Manager & ToolkitEnlightenment: A Cross Platform Window Manager & Toolkit
Enlightenment: A Cross Platform Window Manager & Toolkit
 
COMPUTER LANGUAGES AND THERE DIFFERENCE
COMPUTER LANGUAGES AND THERE DIFFERENCE COMPUTER LANGUAGES AND THERE DIFFERENCE
COMPUTER LANGUAGES AND THERE DIFFERENCE
 
The Future of Cross-Platform is Native
The Future of Cross-Platform is NativeThe Future of Cross-Platform is Native
The Future of Cross-Platform is Native
 
Week 8 intro to python
Week 8   intro to pythonWeek 8   intro to python
Week 8 intro to python
 
Ndk
NdkNdk
Ndk
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZF
 
DSL Construction rith Ruby
DSL Construction rith RubyDSL Construction rith Ruby
DSL Construction rith Ruby
 
Velocity-EHF for Android
Velocity-EHF for AndroidVelocity-EHF for Android
Velocity-EHF for Android
 

Similar to Shell scripting with f

Overview new programming languages
Overview new programming languagesOverview new programming languages
Overview new programming languages
umoren
 
The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012
Jan Jongboom
 
Modified.net overview
Modified.net overviewModified.net overview
Modified.net overview
Faisal Aziz
 

Similar to Shell scripting with f (20)

Evalution about programming language part 1
Evalution about programming language part 1Evalution about programming language part 1
Evalution about programming language part 1
 
Porting E-poetry: The Case of First Screening
Porting E-poetry: The Case of First ScreeningPorting E-poetry: The Case of First Screening
Porting E-poetry: The Case of First Screening
 
Overview new programming languages
Overview new programming languagesOverview new programming languages
Overview new programming languages
 
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
Bioinformatica p1-perl-introduction
Bioinformatica p1-perl-introductionBioinformatica p1-perl-introduction
Bioinformatica p1-perl-introduction
 
Intro
IntroIntro
Intro
 
Intro
IntroIntro
Intro
 
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
 
2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge
 
The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012
 
C# Fundamental
C# FundamentalC# Fundamental
C# Fundamental
 
Modified.net overview
Modified.net overviewModified.net overview
Modified.net overview
 
Erlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent WorldErlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent World
 
Shell scrpting(payal harne)
Shell scrpting(payal harne)Shell scrpting(payal harne)
Shell scrpting(payal harne)
 
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
 
Ruby and Security
Ruby and SecurityRuby and Security
Ruby and Security
 
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
 
Week - 04, 05 Software Chapter 2 info sys.ppt
Week - 04, 05 Software Chapter 2 info sys.pptWeek - 04, 05 Software Chapter 2 info sys.ppt
Week - 04, 05 Software Chapter 2 info sys.ppt
 
.NET - The Current Spectrum
.NET -  The Current Spectrum.NET -  The Current Spectrum
.NET - The Current Spectrum
 
Php
PhpPhp
Php
 

More from OnorioCatenacci (6)

Basics Of Elixir and Phoenix
Basics Of Elixir and Phoenix Basics Of Elixir and Phoenix
Basics Of Elixir and Phoenix
 
Gentle Introduction To Funcitonal Programming - Detroit.Code
Gentle Introduction To Funcitonal Programming - Detroit.CodeGentle Introduction To Funcitonal Programming - Detroit.Code
Gentle Introduction To Funcitonal Programming - Detroit.Code
 
Building An Elixir Package
Building An Elixir PackageBuilding An Elixir Package
Building An Elixir Package
 
Alternate languages for the CLR
Alternate languages for the CLRAlternate languages for the CLR
Alternate languages for the CLR
 
A RESTful Interface for Erlang Code using Webmachine
A RESTful Interface for Erlang Code using WebmachineA RESTful Interface for Erlang Code using Webmachine
A RESTful Interface for Erlang Code using Webmachine
 
A Sip Of Elixir
A Sip Of ElixirA Sip Of Elixir
A Sip Of Elixir
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 

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